09/10/2018, 18:18

Giúp tôi hoàn thành nốt trang phản hồi ý kiến.

Hiện nay tôi đã xây dựng xong một form phản hồi ý kiến cho trang Web. Nhưng mới chỉ làm xong phần cơ bản. Tôi đang rất lúng túng trong việc cho nó hoạt động như thế nào. Toàn bộ code của tôi là:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Y Kien</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body background="Images/903TORN.gif">
<p align="center">
<marquee behavior="alternate" loop="-1" scrollamount="20">
<img src="Images/ykien.gif" editor="Webstyle3" moduleid="Default (Project)ykien.xws" border="0">
</marquee><br>
<img src="Images/Divider1.gif" editor="Webstyle3" moduleid="Default (Project)Divider1.xws" border="0">
</p>
<form action="" method="post" enctype="multipart/form-data" name="form" id="form">
<div align="center">
<table width="550" border="2" cellpadding="0" cellspacing="0" bordercolor="#FF6633">
<tr>
<td><table width="100%" border="0" cellpadding="10" cellspacing="0" id="chitiet">
<tr>
<td colspan="3"><div align="center"><strong><font color="#FF0000" size="5" face="Arial, Helvetica, sans-serif">What
Do You Think?</font></strong><br>
<img src="Images/Divider2.gif" editor="Webstyle3" moduleid="Default (Project)Divider2.xws" border="0">
</div></td>
</tr>
<tr>
<td> <p align="center"> <strong>
<input name="radio" type="radio" value="Kha">
Khá</strong></p></td>
<td> <div align="center"> <strong>
<input name="radio" type="radio" value="Trung binh" checked>
Trung bình</strong></div></td>
<td> <div align="center"> <strong>
<input type="radio" name="radio" value="Cancogang">
Cần cố gắng thêm</strong></div></td>
</tr>
<tr>
<td colspan="3"> <div align="center"><font color="#FF0000" size="5" face="Arial, Helvetica, sans-serif"><strong>Bạn
thích trang nà o nhất?</strong></font><br>
<img src="Images/Divider2.gif" width="300" height="19"> </div></td>
</tr>
<tr>
<td> <div align="center"> <strong>
<input name="Bongda" type="checkbox" id="Bongda" value="Bongda" checked>
Bóng đá</strong></div></td>
<td> <div align="center"> <strong>
<input name="Bangai" type="checkbox" id="Bangai" value="Bangai">
Bạn gái</strong></div></td>
<td> <div align="center"> <strong>
<input name="Vuicuoi" type="checkbox" id="Vuicuoi" value="Vuicuoi">
Vui cười</strong></div></td>
</tr>
<tr>
<td> <div align="center"> <strong>
<input name="Photo" type="checkbox" id="Photo2" value="Photoalbum">
Photos Album</strong></div></td>
<td> <div align="center"> <strong>
<input name="Email" type="checkbox" id="Email2" value="Email">
Send email</strong></div></td>
<td> <div align="center"> <strong>
<input name="Gopy" type="checkbox" id="Gopy2" value="Gop y">
Góp ý</strong></div></td>
</tr>
<tr>
<td colspan="3"> <div align="center">
<h3><font color="#FF0000" size="5">Thông tin cá nhân<br>
<img src="Images/Divider2.gif" width="300" height="19"> </font></h3>
</div></td>
</tr>
<tr>
<td><font color="#660066"><strong>Tên của bạn</strong></font></td>
<td colspan="2"> <div align="left"> <font color="#660066"><strong>
<input name="Name" type="text" id="Name" size="50">
</strong></font></div></td>
</tr>
<tr>
<td><font color="#660066"><strong>Địa chỉ Email</strong></font></td>
<td colspan="2"> <div align="left"> <font color="#660066"><strong>
<input name="Email" type="text" id="Email" size="45">
</strong></font></div></td>
</tr>
<tr>
<td><font color="#660066"><strong>Số điện thoại</strong></font></td>
<td colspan="2"> <div align="left"> <font color="#660066"><strong>
<input name="Phone" type="text" id="Phone" size="20" style="font-Italic">
</strong></font></div></td>
</tr>
<tr>
<td colspan="3"><p><strong><font color="#000099">Ná»™i dung: </font></strong></p>
<p>
<textarea name="noidung" cols="60" rows="10" id="textarea" style="font-size: 12pt; color: #000000"></textarea>
</p></td>
</tr>
<tr>
<td height="75" colspan="2"> <p>
<button type="submit"><img src="Images/Send_Info.gif"></button>
</p></td>
<td> <div align="right">
<button type="reset"><img src="Images/Reset_Form.gif"></button>
</div></td>
</tr>
</table></td>
</tr>
</table>
</div>
</form>
<p align="center">&nbsp; </p>
</body>
</html>

Đây là đương link của nó: http://nobita.gate2vn.net/Gopy.htm
gate2vn viết 20:30 ngày 09/10/2018
1. <form action=""....> <<< cái này trỏ tới 1 file PHP để xử lý
2. File PHP: bắt các giá trị của textbox được submit, có dạng $_POST['tenbien']. Sau đó, cộng tất cả nó vào 1 biến trung gian, dùng hàm mail() gửi nó về email của bạn
thanhvinhptit viết 20:25 ngày 09/10/2018
bạn có thể nói cụ thể hơn giùm không? Tui cũng đang muốn biết về phần này lắm. Nếu trang phản hồi chỉ có email không thì mình cũng làm được nhưng nếu kèm theo những check box trên thì phải làm sao nhỉ?
Yuris_revenge viết 20:23 ngày 09/10/2018
hxxp://www.thesitewizard.com/archive/feedbackphp.shtml <---- bạn tham khảo nhe
pixelart viết 20:24 ngày 09/10/2018
<HTML>
<HEAD>
<TITLE>:: Email ::</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<body bgcolor="#FFEEAA" >
PHP Code:
<?php
if( $Email && $noidung ) {
if(
$mail=="send") {
$headers "From: $Email\r\n"
$headers .= "MIME-Version: 1.0\r\n"
$boundary uniqid("HTMLDEMO"); 
$headers .= "Content-Type: multipart/alternative" 
   
"; boundary = $boundary\r\n\r\n"
$headers .= "This is a MIME encoded message.\r\n\r\n"
$headers .= "--$boundary\r\n" 
   
"Content-Type: text/plain; charset=utf-8\r\n" 
   
"Content-Transfer-Encoding: base64\r\n\r\n"
$headers .= chunk_split(base64_encode("This is the plain text version!")); 
$headers .= "--$boundary\r\n" 
   
"Content-Type: text/html; charset=utf-8\r\n" 
   
"Content-Transfer-Encoding: base64\r\n\r\n"
$headers .= chunk_split(base64_encode("
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
Chào webmaster ! <br><br>
<font color='green'>
$Name</font> gửi cho bạn 1 lá thư từ website của bạn với nội dung sau đây :
<br>
Bạn cảm thấy thế nào ? : <b>
$radio</b>
<br>
Bạn thích trang nào nhất ? : <b>
$Bongda</b>
<br>
Số điện thọai : <b>
$Phone</b><br>
<b>
$noidung</b> :<br><br>
$noidung
<br>

Rất cám ơn bạn đã dành chút thời gian đọc
<br><br><br>

Pixelart
"
));
//send message 
mail("vnpixelart@yahoo.com""$Email gui cho ban 1 la thu tu website cua ban"""$headers); 

################
$url "./";
echo 
"

<html>

<head><title>"
.$title."</title>

<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">

<meta http-equiv=\"refresh\" content=\"2;url="
.$url."\">

<LINK href=\"style.css\" type=\"text/css\" rel=\"stylesheet\">

<br><br><br><br><br><br><br><br><br><br><TABLE cellSpacing=0 cellPadding=0 width='350' border=0 style='BORDER: #a3e0f4 1px solid' align='center'>"

."<TR>"

."<TD bgcolor='a3e0f4' width='100%' height='25' align='center'> &nbsp;<span class=copy1><font color='#FF6600'><b>GỬI EMAIL ĐẾN WEBMASTER</b></font></span></TD>"

."</TR>"

."<TR>"

."<TD bgcolor='f2fdff' width='20' height='10'></TD>"

."</TR>"

."<tr><td>"

."<table width='90%' align='center'>"

."<tr align=left valign=top><td width=100% class='copy'>"

."<br>OK, Bạn đã gửi 1 bức thư đến webmaster ! Cám ơn bạn nhiều<br><br>"

."<font color='red'><a href='$url'>Click vào đây nếu trình duyệt ko tự chuyển</a></font>"

."</td></tr>\n"

."</table></td></tr></table></div>";
//
exit;
###############
}}
?>
<p align="center">
<marquee behavior="alternate" loop="-1" scrollamount="20">
<img src="Images/ykien.gif" editor="Webstyle3" moduleid="Default (Project)\ykien.xws" border="0">
</marquee><br>
<img src="Images/Divider1.gif" editor="Webstyle3" moduleid="Default (Project)\Divider1.xws" border="0">
</p>
<form method="post" action="?mail=send" enctype="multipart/form-data" name="form" id="form">
<div align="center">
<table width="550" border="2" cellpadding="0" cellspacing="0" bordercolor="#FF6633">
<tr>
<td><table width="100%" border="0" cellpadding="10" cellspacing="0" id="chitiet">
<tr>
<td colspan="3"><div align="center"><strong><font color="#FF0000" size="5" face="Arial, Helvetica, sans-serif">What
Do You Think?</font></strong><br>
<img src="Images/Divider2.gif" editor="Webstyle3" moduleid="Default (Project)\Divider2.xws" border="0">
</div></td>
</tr>
<tr>
<td> <p align="center"> <strong>
<input name="radio" type="radio" value="Kha">
Khá</strong></p></td>
<td> <div align="center"> <strong>
<input name="radio" type="radio" value="Trung binh" checked>
Trung bình</strong></div></td>
<td> <div align="center"> <strong>
<input type="radio" name="radio" value="Cancogang">
Cần cố gắng hơn</strong></div></td>
</tr>
<tr>
<td colspan="3"> <div align="center"><font color="#FF0000" size="5" face="Arial, Helvetica, sans-serif"><strong>
Bạn thích trang nào nhất</strong></font><br>
<img src="Images/Divider2.gif" width="300" height="19"> </div></td>
</tr>
<tr>
<td> <div align="center"> <strong>
<input name="Bongda" type="checkbox" id="Bongda" value="Bongda" checked>
Bóng đá</strong></div></td>
<td> <div align="center"> <strong>
<input name="Bangai" type="checkbox" id="Bangai" value="Bangai">
Bạn gái</strong></div></td>
<td> <div align="center"> <strong>
<input name="Vuicuoi" type="checkbox" id="Vuicuoi" value="Vuicuoi">
Vui cười</strong></div></td>
</tr>
<tr>
<td> <div align="center"> <strong>
<input name="Photo" type="checkbox" id="Photo2" value="Photoalbum">
Photos Album</strong></div></td>
<td> <div align="center"> <strong>
<input name="Email" type="checkbox" id="Email2" value="Email">
Send email</strong></div></td>
<td> <div align="center"> <strong>
<input name="Gopy" type="checkbox" id="Gopy2" value="Gop y">
Góp ý</strong></div></td>
</tr>
<tr>
<td colspan="3"> <div align="center">
<h3><font color="#FF0000" size="5">Thông tin cá nhân<br>
<img src="Images/Divider2.gif" width="300" height="19"> </font></h3>
</div></td>
</tr>
<tr>
<td><font color="#660066"><strong>Tên của bạn</strong></font></td>
<td colspan="2"> <div align="left"> <font color="#660066"><strong>
<input name="Name" type="text" id="Name" size="50">
</strong></font></div></td>
</tr>
<tr>
<td><font color="#660066"><strong>Email của bạn <font color="#FF0000">*</font></strong></font></td>
<td colspan="2"> <div align="left"> <font color="#660066"><strong>
<input name="Email" type="text" id="Email" size="45">
</strong></font></div></td>
</tr>
<tr>
<td><font color="#660066"><strong>Số điện thọai</strong></font></td>
<td colspan="2"> <div align="left"> <font color="#660066"><strong>
<input name="Phone" type="text" id="Phone" size="20" style="font-Italic">
</strong></font></div></td>
</tr>
<tr>
<td colspan="3"><p><strong><font color="#000099">Nội dung: <font color="#FF0000">*</font></font></strong></p>
<p>
<textarea name="noidung" cols="60" rows="10" id="textarea" style="font-size: 12pt; color: #000000"></textarea>
</p></td>
</tr>
<tr>
<td height="75" colspan="2"> <p>
<button type="submit"><img src="Images/Send_Info.gif"></button>
</p></td>
<td> <div align="right">
<button type="reset"><img src="Images/Reset_Form.gif"></button>
</div></td>
</tr>
</table></td>
</tr>
</table>
</div>
</form>
<p align="center">&nbsp; </p>
</body>
</html>


</BODY>
</HTML>
Bạn tạo 1 file có đuôi .php , upload lên server có hỗ trợ hàm mail() là okies
pixelart viết 20:34 ngày 09/10/2018
Chết, quên mất cái phần bóng đá và Check email
Buồn ngủ quá rồi, mai trả lới típ cho
thanhvinhptit viết 20:34 ngày 09/10/2018
Em test rồi, không thấy email sent cho mình. Mặc dù nó vẫn la rằng: "okie! Một email đã được gởi tới Webmaster, cám ơn bạn nhiều". BẠn coi lại giùm nhá. Thanks so lot.
Bim viết 20:34 ngày 09/10/2018
Test ở đâu mới đưôc chớ?
thanhvinhptit viết 20:33 ngày 09/10/2018
Thì up lên host, rồi test thử chớ giề. Tui là admin lun rùi mà đâu nhận được cái mail phản hồi nào mô ?
pixelart viết 20:33 ngày 09/10/2018
Tôi đã test trên host và nó gửi bình thường

Bạn xem lại xem có vào bulkmail không . Bạn phải edit vnpixelart@yahoo.com thành email của bạn
Bài liên quan
0