|
 |
|
มีปัญหาเกี่ยวกับโค๊ดครับ ช่วยดูให้ผมทีครับ ว่าผิดตรงไหน |
|
 |
|
|
 |
 |
|
คือผมทำหน้า Form ที่จะส่งค่าไปอีก Form นึงอะครับ แต่ปรากฏว่า Form ที่รับค่าไป มันเอ๋อๆ อะครับ
แบบว่า ผมมีสคริปที่ไว้ใช้รับค่า จาก Form1
Code
<?
$user_reg = trim($_POST[user_reg]);
$pass_reg1= trim($_POST[pass_reg1]);
$pass_reg2 = trim($_POST[pass_reg2]);
$name_reg= trim($_POST[name_reg]);
$sex_reg= trim($_POST[sex_reg]);
$email_reg= trim($_POST[email_reg]);
$address_reg= trim($_POST[address_reg]);
$question_pass=trim($_POST[question_pass]);
$ans_pass=trim($_POST[ans_pass]);
$date_reg=date("Y-m-d");
if ($user_reg=="" ) {
echo "<h3>กรุณากรอก username</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if (strlen($user_reg) < 4 ) {
echo "<h3>กรุณากรอก Username อย่างน้อย 4 ตัว</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if ($pass_reg1=="") {
echo"<h3>กรุณากรอก Password</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if ($pass_reg2=="") {
echo"<h3>กรุณายืนยัน Password</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if ($pass_reg1 != $pass_reg2) {
echo"<h3>กรุณากรอก Password ให้เหมือนกัน</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if ($email_reg=="") {
echo"<h3>กรุณากรอก Email</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
include "function_register.php";
if (!checkemail($email_reg)) {
echo "<h3>รูปแบบอีเมลที่กรอกไม่ถูกต้องนะครับ </h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if ($name_reg=="") {
echo"<h3>กรุณากรอก ชื่อ-นามสกุล</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if ($tel_reg=="") {
echo"<h3>กรุณากรอกเบอร์โทรศัพท์</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if ($question_pass=="") {
echo"<h3>กรุณาเลือกคำถามกันลืม</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
if ($ans_pass=="") {
echo"<h3>กรุณากรอกคำตอบกันลืม</h3>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
exit();
}
include "connect.php";
$sql = "select * from tb_member where username='$user_reg' ";
$dbquery = mysql_query($sql);
$result = mysql_fetch_array($dbquery);
if ($result) {
echo"<b>มีผู้ใช้ $username อยู่แล้วกรุณาเปลี่ยน username</b>";
echo"<a href='register.php'>ไปหน้าสมัครสมาชิก</a>";
die;
}
/*
$sql="select * from tb_member where username='$user_reg' ";
$result=mysql_db_query($dbname,$sql);
$num=mysql_num_rows($result);
if($num>0) {
echo "<h3>Username ซ้ำครับ </h3>"; exit();
}
*/
$sql="insert into tb_member values('','$user_reg','$pass_reg1','$name_reg', '$sex_reg','$email_reg','$tel_reg','$address_reg', '$question_pass','$ans_pass','$date_reg')";
$result=mysql_db_query($dbname,$sql);
if ($result) {
echo "<h3>ข้อมูลของท่านถูกบันทึกเรียบร้อยแล้ว</h3>";
echo "<A HREF='login.php'>คลิกเพื่อเข้าระบบสมาชิก</A><BR><BR>";
} else {
echo "<h3>ไม่สามารถสมัครเป็นสมาชิกได้</h3>";
}
mysql_close();
?>
ปกติแล้ว มันจะมีรูปภาพ footer อะครับ แบบเวปทั่วๆไป พอมีสคริป ตัวนี้มาเพิ่ม ภาพด้านล่างเว็ปของผม (footer) ของผมหายไปเฉยเลยครับ แบบว่า โค๊ดทุกอย่างทีมันอยู่หลังสคริปตัวนี้ ไม่สามารถใช้งานได้เลยครับ ผม include ไฟล์มันก็ไม่ยอมอ่าน
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-02-10 20:05:37 |
By :
ramuna99 |
View :
883 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้ว script นี้มันสามารถทำงานได้เป็นปกติหรือเปล่าอ่ะคับ
หรือว่ามันส่วนไหนที่มันติดหรือเปล่า...
|
 |
 |
 |
 |
Date :
2009-02-10 21:01:06 |
By :
ochitae |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำได้เป็นปกติครับ
|
 |
 |
 |
 |
Date :
2009-02-10 21:15:15 |
By :
ramuna99 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมลงมั่วๆดูแล้วมันเป็นที่คำสั่ง if ตรง exit(); พอผมลบออกไปมันก็มี footer โผล่มาให้ครับ พอใส่คืน ดันหาย
อยากถามพี่ๆว่า คำสั่ง if ซ้อน if ถูกต้องตามด้านบนหรือไม่ครับ
|
 |
 |
 |
 |
Date :
2009-02-10 21:45:28 |
By :
ramuna99 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|