|
 |
|
ปัญหาเช็ตอีเมลล์คะ ในภาพนี้เออเรอร์ในกรณีที่กรอกรูปแบบอีเมลล์ถูกต้อง แล้ว user ที่สมัคร |
|
 |
|
|
 |
 |
|
เคยถามแล้วทำตามแล้ว กระทู้นี้ https://www.thaicreate.com/php/forum/028784.html
ปรากฎว่าทำได้
พอวันรุ่งขึ้นมาเทสอีกรอบ ทีนี้มันเออเรอร์คะ
ในภาพนี้เออเรอร์ในกรณีที่กรอกรูปแบบอีเมลล์ถูกต้อง แล้ว user ที่สมัคร นั้นมีและไม่มีในดาต้าเบส
ข้อความเตือนว่าสมัครเรียบร้อยแล้วแต่จริงๆแล้วมันไม่ได้เข้าไปในดาต้าเบสเลย

หน้าre_cus.php
Code (PHP)
<?php
<form method="post" action="check_regis.php" name="myForm" onSubmit="JavaScript:return fncSubmit();">
<input name="email" type="text" id="email" />
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="reset" value="Clear" />
</form>
?>
อันนี้ฟังก์ชั่นคะคิดว่าไม่น่าผิดเพราะได้ทำเว็บบอร์ดแล้วเรียกเช็คแต่ไม่มีปัญหาอะไรเลย
Code (PHP)
<?php
function checkemail($checkemail) {
if(ereg( "^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]) {2}|net|com|gov|mil|org|edu|int)$",$checkemail) ){
return true;
} else {
return false;
}
}
?>
Code (PHP)
<?php
<?
$username = $_POST["username"];
$password = $_POST["password"];
$password2 = $_POST["password2"];
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$company = $_POST["company"];
$gender = $_POST["gender"];
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_POST["year"];
$email = $_POST["email"];
$address = $_POST["address"];
$country = $_POST["country"];
$postal_code = $_POST["postal_code"];
$tel = $_POST["tel"];
$fax = $_POST["fax"];
$mobile = $_POST["mobile"];
$favourite_color = $_POST["favourite_color"];
include('function.php');
if(!checkemail($email)){
echo "<script language='javascript'>alert('Invalid Email format.');history.back();</script> ";
}
$sql_user = "Select * From tbregister Where username='$username' ";
$result = mysql_query($sql_user);
$row= mysql_fetch_array($result);
if ($row['username'])
echo "<script language='javascript'>alert('This username is already in use.');history.back();</script> ";
include "connectdb.php";
$sql = <<<SQL
insert into tbregister values('','$username','$password','$password2','$firstname','$lastname','$company','$gender','$day','$month','$year','$email','$address','$country',$postal_code,$tel,$fax,$mobile,'$favourite_color');
SQL;
$result=mysql_query($sql);
$msg = "";
$resetForm = "";
if($link==0){
$msg = "<p class='red2'>";
$msg .= "Sorry, you are not able to be registered.";
echo "<meta http-equiv='refresh' content='5; url=re_cus.php' />";
}
else{
echo "<p class='red2'>Thank you. You are already registered.</p>";
echo "<meta http-equiv='refresh' content='5; url=service.php' />";
$resetForm = "document.getElementById('myForm').reset();";
}
mysql_close($link);
?>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-07-03 13:54:51 |
By :
SG14 |
View :
1108 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ลองไปดูที่ ไฟล์ check_regi.php บรรทัดที่87 อ่ะคับ ไม่งั้นก็ขอดูโค้ด ไฟล์ check_regi.php หน่อยอ่ะคับ
เพื่อจะช่วยได้บ้าง
|
 |
 |
 |
 |
Date :
2009-07-03 14:47:47 |
By :
somparn |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไฟล์ check_regis.php คืออันล่างสุดคะลืมเขียนบอกไป ที่รับค่าอะคะ
ตอนนี้ลองเช็คโค๊ดไปเรื่อยๆ เหลือเช็ค user อย่างเดียวแล้วคะ คือกรอกซ้ำมันก็สมัครได้อะคะตอนนี้
|
 |
 |
 |
 |
Date :
2009-07-03 15:05:53 |
By :
SG14 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันก็คือบรรทัด87 คือบรรทัดที่31ของที่โพสมาอะคะ
|
 |
 |
 |
 |
Date :
2009-07-03 15:11:22 |
By :
SG14 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|