ช่วยดูโค๊ดส่งเมล์ให้หน่อยค่ะ หน้าฟอร์มที่กรอกข้อมูลนะค่ะ ปัญหามันคือ ตอนมันส่งเมล์มันไม่ยอมรีเฟรชหน้ากลับไปหน้าอินเดกซ์อะค่ะ แต่เมลล์เข้านะค่ะ
หน้าฟอร์มที่กรอกข้อมูลนะค่ะ
<?
include("config/conn.php");
include("config/config.php");
include("config/func.inc.php");
include("include/switch_language.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Saangsuk 99., made be happy</title>
<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
margin-top: 0px;
background-image: url(images/bg.jpg);
background-repeat: repeat-x;
}
body,td,th {
font-family: Tahoma, Microsoft Sans Serif, sans-serif;
font-size: 13px;
color: #5E5E5E;
}
-->
</style>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {font-weight: bold}
-->
</style>
</head>
<body>
<table width="930" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><? include("include/head.php");?></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8%"><img src="images/saang-suk_04.jpg" width="73" height="17" alt="" /></td>
<td width="87%"><? include("include/language.php");?></td>
<td width="5%"><img src="images/saang-suk_06.jpg" width="75" height="17" alt="" /></td>
</tr>
<tr>
<td background="images/saang-suk_07.jpg"> </td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="boderdot"><span class="headpink">CONTACT</span><span class="black"> US</span></td>
</tr>
<tr>
<td><? if($_SESSION["language"]=='th'){?>
<br />
<span class="gray"><strong class="black2">บริษัท สร้างสุข 999 จำกัด</strong><br />
<strong>403/23 ถ. ลำพูน ต. วัดเกตุ อ. เมือง จ. เชียงใหม่ 50000</strong><br />
</span><span class="black2"><strong>โทรศัพท์:</strong></span><span class="gray"><strong> 0 5380 2145 </strong></span><span class="black2"><strong> มือถือ:</strong></span><span class="gray"><strong> 08 0591 3859, 08 6927 4237, 08 9682 0323<br />
</strong></span><span class="black2"><strong>อีเมล์:</strong></span><span class="gray"><strong> [email protected] <br />
</strong></span><span class="black2"><strong>เว็บไซด์:</strong></span><span class="gray"><strong> www.madebehappy.com</strong></span>
<br />
</span><br />
<form id="form" name="form" method="post" action="contact-complete.php" target="uploadtarget">
<table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="5%"><img src="images/box_01.jpg" width="12" height="13" alt="" /></td>
<td width="83%" background="images/box_02.jpg"><img src="images/box_02.jpg" width="4" height="13" alt="" /></td>
<td width="12%"><img src="images/box_04.jpg" width="16" height="13" alt="" /></td>
</tr>
<tr>
<td background="images/box_05.jpg"><img src="images/box_05.jpg" alt="" width="12" height="3" border="0" /></td>
<td><table width="445" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><span class="headpink2">CONTACT</span> <span class="black2">FORM<br />
</span>
<table width="444" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="boderdot"> </td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="63"> </td>
<td width="110"><strong>ชื่อ :</strong></td>
<td width="272"><input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td> </td>
<td><strong>E-mail :</strong></td>
<td><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td> </td>
<td><strong>เบอร์โทรติดต่อ :</strong></td>
<td><input type="text" name="phone" id="phone" /></td>
</tr>
<tr>
<td> </td>
<td><strong>หัวเรื่อง :</strong></td>
<td><input type="text" name="title" id="title" /></td>
</tr>
<tr>
<td> </td>
<td><strong>รายละเอียด :</strong></td>
<td><textarea name="detail" id="detail" cols="25" rows="4"></textarea></td>
</tr>
<tr>
<td> </td>
<td><strong>กรุณาใส่รหัส :</strong></td>
<td><input name="numtest" type="text" id="numtest" />
<span class="style1"><br />
*</span>
<?
$random0 = rand(1,9);
$random1 = rand(1,9);
$random2 = rand(1,9);
$random3 = rand(1,9);
$random4 = rand(1,9);
?>
<input name="numtest22" type="hidden" id="numtest22" value="<? echo "$random0"; ?><? echo "$random1"; ?><? echo "$random2"; ?><? echo "$random3"; ?><? echo "$random4"; ?>" />
<img src="images/<? echo "$random0"; ?>.gif" align="absmiddle" /><img src="images/<? echo "$random1"; ?>.gif" align="absmiddle" /><img src="images/<? echo "$random2"; ?>.gif" align="absmiddle" /><img src="images/<? echo "$random3"; ?>.gif" align="absmiddle" /> <br />
<span class="thaismall_back">Require (<span class="style1">*</span>) and the code</span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="submit" id="submit" value="Send Us" onclick="return chkFemc();"/>
<input type="reset" name="reset" id="reset" value="Cancle" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
<td background="images/box_08.jpg"><img src="images/box_08.jpg" width="16" height="3" alt="" /></td>
</tr>
<tr>
<td><img src="images/box_13.jpg" width="12" height="16" alt="" /></td>
<td background="images/box_14.jpg"><img src="images/box_14.jpg" alt="" width="4" height="16" border="0" /></td>
<td><img src="images/box_16.jpg" width="16" height="16" alt="" /></td>
</tr>
</table>
</form><iframe id="uploadtarget" name="uploadtarget" src="" style="width:0px;height:0px;border:0"></iframe> <div id="upmsg"></div>
<? }else{ ?>
<form id="form" name="form" method="post" action="contact-complete.php" target="uploadtarget">
<strong> <br />
<span class="black2">Saarngsuk 999 Co., Ltd.</span></strong><span class="gray"><br />
<strong>403/23 Lamphun Rd., T. Watket,A. Muang, Chiang Mai 50000</strong><br />
</span><span class="black2"><strong>Tel:</strong></span><span class="gray"><strong> 0 5380 2145 </strong></span><span class="black2"><strong>Mobile:</strong></span><span class="gray"><strong> 08 0591 3859, 08 6927 4237, 08 9682 0323</strong><br />
</span><span class="black2"><strong>E-mail:</strong></span><span class="gray"><strong> [email protected] </strong></span><span class="black2"><strong><br />
website:</strong></span><span class="gray"><strong> www.madebehappy.com</strong></span><span class="page"> <br />
</span><br />
<table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="5%"><img src="images/box_01.jpg" width="12" height="13" alt="" /></td>
<td width="83%" background="images/box_02.jpg"><img src="images/box_02.jpg" width="4" height="13" alt="" /></td>
<td width="12%"><img src="images/box_04.jpg" width="16" height="13" alt="" /></td>
</tr>
<tr>
<td background="images/box_05.jpg"><img src="images/box_05.jpg" alt="" width="12" height="3" border="0" /></td>
<td><table width="445" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><span class="headpink2">CONTACT</span> <span class="black2">FORM<br />
</span>
<table width="444" height="17" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="205" class="boderdot"> </td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="63"> </td>
<td width="110"><strong>Name :</strong></td>
<td width="272"><input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td> </td>
<td><strong>E-mail :</strong></td>
<td><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td> </td>
<td><strong>Phone :</strong></td>
<td><input type="text" name="phone" id="phone" /></td>
</tr>
<tr>
<td> </td>
<td><strong>Subject :</strong></td>
<td><input type="text" name="title" id="title" /></td>
</tr>
<tr>
<td> </td>
<td><strong>Detail :</strong></td>
<td><textarea name="detail" id="detail" cols="25" rows="4"></textarea></td>
</tr>
<tr>
<td> </td>
<td><strong>Please Fill Number :</strong></td>
<td><input name="numtest" type="text" id="numtest" />
<span class="style1"><br />
*</span>
<?
$random0 = rand(1,9);
$random1 = rand(1,9);
$random2 = rand(1,9);
$random3 = rand(1,9);
$random4 = rand(1,9);
?>
<input name="numtest" type="hidden" id="numtest" value="<? echo "$random0"; ?><? echo "$random1"; ?><? echo "$random2"; ?><? echo "$random3"; ?><? echo "$random4"; ?>" />
<img src="images/<? echo "$random0"; ?>.gif" align="absmiddle" /><img src="images/<? echo "$random1"; ?>.gif" align="absmiddle" /><img src="images/<? echo "$random2"; ?>.gif" align="absmiddle" /><img src="images/<? echo "$random3"; ?>.gif" align="absmiddle" /> <br />
<span class="thaismall_back">Require (<span class="style1">*</span>) and the code</span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" id="button" value="Send Us" onclick="return chkFemc();" />
<input type="reset" name="button2" id="button2" value="Cancle" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
<td background="images/box_08.jpg"><img src="images/box_08.jpg" width="16" height="3" alt="" /></td>
</tr>
<tr>
<td><img src="images/box_13.jpg" width="12" height="16" alt="" /></td>
<td background="images/box_14.jpg"><img src="images/box_14.jpg" alt="" width="4" height="16" border="0" /></td>
<td><img src="images/box_16.jpg" width="16" height="16" alt="" /></td>
</tr>
</table>
</form><iframe id="uploadtarget" name="uploadtarget" src="" style="width:0px;height:0px;border:0"></iframe> <div id="upmsg"></div>
<? } ?></td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
<td background="images/saang-suk_09.jpg"> </td>
</tr>
<tr>
<td><img src="images/saang-suk_10.jpg" width="73" height="36" alt="" /></td>
<td><img src="images/saang-suk_11.jpg" width="782" height="36" alt="" /></td>
<td><img src="images/saang-suk_12.jpg" width="75" height="36" alt="" /></td>
</tr>
<tr>
<td> </td>
<td><? include("include/foot.php");?></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<script language="javascript">
function chkFemc()
{
var obj1=document.form;
var emailStr=document.form.email.value;
if(document.getElementById('name').value == '' )
{
alert("Please fill your Name/กรุณากรอกชื่อของคุณด้วยค่ะ");
document.getElementById('name').focus();
return false;
}
if(document.getElementById('email').value.length == 0)
{
alert('Please fill your E-mail/กรุณากรอกอีเมล์ของคุณ');
document.getElementById('email').focus();
return false;
}
//
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
alert("Your E-mail Not Correct/E - Mail ของคุณไม่ถูกต้อง กรุณากรอกข้อมูลใหม่")
obj1.email.focus()
return false
}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
alert("E - Mail ของคุณไม่ถูกต้อง กรุณากรอกข้อมูลใหม่")
obj1.email.focus()
return false
}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!")
obj1.email.focus()
return false
}
}
return true
}
var domainArray=domain.match(domainPat)
if (domainArray==null) {
alert("The domain name doesn't seem to be valid.")
obj1.email.focus()
return false
}
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 ||
domArr[domArr.length-1].length>3) {
alert("This email address is not correct.")
obj1.email.focus()
return false
}
if (len<2) {
var errStr="This address is missing a hostname!"
alert(errStr)
obj1.email.focus()
return false
}
//
if(document.getElementById('phone').value.length == 0)
{
alert('Please fill your Telephone/กรุณากรอกเบอร์โทรศัพท์ของคุณ');
document.getElementById('phone').focus();
return false;
}
if(document.getElementById('title').value.length == 0)
{
alert('Please fill your Subject/กรุณากรอกหัวข้อที่ต้องการติดต่อ');
document.getElementById('title').focus();
return false;
}
if(document.getElementById('detail').value.length == 0)
{
alert('Please fill your Detail/กรุณารายละเอียด');
document.getElementById('detail').focus();
return false;
}
}
function uploadok(pathfile)
{
document.getElementById('upmsg').innerHTML = '' ;
alert( 'You will send Data complete!/คุณได้ส่งข้อมูลถึงเราเรียบร้อย') ;
window.location.href='index.php';
document.getElementById('form').reset() ;
return true ;
}
function uploaderror(pathfile)
{
alert(pathfile) ;
return true ;
}
</script>
โค๊ดหน้าที่รับข้อมูลแล้วส่งเข้าเมล์ค่ะ
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
include("config/conn.php");
include("config/config.php");
include("config/func.inc.php");
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$subject=$_POST['title'];
$message=$_POST['detail'];
if($email){
$today=date('Y-m-d H:i:s');
//insert_data("insert into contact set name='$name',address='$address',email='$email',phone='$phone',country='$country', subject='$subject',messages='$message', post_date='$today' ");
$to="[email protected] ";//ใส่เมลล์ [email protected]
/* Content-type header. */
$mailheaders = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/html; charset=utf-8 \r\n";
$mailheaders.= "From: $name <$email> \n";
$mailheaders.= "Reply-To: <$email>\n\n";
$msg = "Contact Form from www.Saarngsuk 999.com<br>";
$msg .= "_____________________________________________________________________<br>";
$msg .= "Name: $name <br>";
if($address){ $msg .= "Address: $address <br>"; }
$msg .= "Phone: $phone <br>";
$msg .= "E-mail: $email <br>";
$msg .= "Subject: $subject <br>";
$msg .= "Detail: <br>";
$msg .= "$message <br>";
// $msg .= "Message:<br>$content\<br>";
$msg .= "_____________________________________________________________________<br>";
//$Fromback="[email protected] ";
//mail("$to","$subject","$msg","$mailheaders","-f $Fromback");
if(mail("$to","$subject","$msg","$mailheaders")){
echo"<meta http-equiv=\"refresh\" content=\"0;url=index.php\"/>";
exit;
}else{
echo"<meta http-equiv=\"refresh\" content=\"0;url=index.php\"/>";
exit;
}
}
?>
ปัญหามันคือ ตอนมันส่งเมล์มันไม่ยอมรีเฟรชหน้ากลับไปหน้าอินเดกซ์อะค่ะ แต่เมลล์เข้านะค่ะ
ช่วยดูให้ทีค่ะ ขอบคุนค่ะTag : - - - -
Date :
2010-02-17 14:21:20
By :
kwangz_07
View :
1301
Reply :
1
Load balance : Server 00