|
 |
|
เกี่ยวกับ WebBoard PHP ช่วยดูให้หน่อยครับ ช่วยดูสคริปต์ให้ด้วยครับ |
|
 |
|
|
 |
 |
|
ช่วยดูสคริปต์ให้ด้วยครับ
<?
include "function.php";
$title_ques=$_POST[title_ques];
$detail_ques=$_POST[detail_ques];
$name_ques=$_POST[name_ques];
$email_ques=$_POST[email_ques];
if ($title_ques==" " or $detail_ques==" " or $name_ques==" "
or $email_ques==" ") {
echo "<h3>ERROR : กรุณากรอกข้อมูลให้ครบนะครับ<h3>";
exit();
}
if (!checkemail ($email_ques)) {
echo "<h3>ERROR : รูปแบบอีเมลที่กรอกไม่ถูกต้องนะครับ<h3>";
exit();
}
$date_ques=date("Y-m-d");
include "connect.php";
$sql="insert into tb_question
values('$title_ques','$detail_ques','$name_ques','$email_ques','$date_ques')";
$result=mysql_db_query($dbname,$sql);
if ($result) {
echo"<h3>ตั้งคำถามของ $name_ques ในกระทู้ ถาม - ตอบ เรียบร้อยแล้วครับ<h3>";
echo"<A HREF='question_view.php'>คลิกกลับสู่หน้าหลัก</A>";
} else {
echo"<h3>ERROR : ไม่สามารถตั้งคำภามในกระทู้ ถาม - ตอบ ได้</h3>";
}
?>
ผิดพลาดตรงไหนครับช่วยตอบที ทำไม ERROR แบบนี้
Notice: Use of undefined constant title_ques - assumed 'title_ques' in C:\Inetpub\wwwroot\main_files\question_save.php on line 3
Notice: Use of undefined constant detail_ques - assumed 'detail_ques' in C:\Inetpub\wwwroot\main_files\question_save.php on line 4
Notice: Use of undefined constant name_ques - assumed 'name_ques' in C:\Inetpub\wwwroot\main_files\question_save.php on line 5
Notice: Use of undefined constant email_ques - assumed 'email_ques' in C:\Inetpub\wwwroot\main_files\question_save.php on line 6
ERROR : รูปแบบอีเมลที่กรอกไม่ถูกต้องนะครับ
รายละเอียดจากไฟล์ function.php
<?
function displaydate ($x) {
$thai_m=array ("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม",
"กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
$date_array=explode("-",$x);
$y=$date_array[0];
$m=$date_array[1] - 1;
$d=$date_array[2];
$m=$thai_m[$m];
$y=$y+543;
$displaydate="$d $m $y";
return $displaydate;
}
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;
}
}
?>
รบกวนตรวจสอบให้ด้วยครับ
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
27 เม.ย. 2549 18:09:24 |
By :
นพ |
View :
2379 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$title_ques=$_POST[title_ques];
$detail_ques=$_POST[detail_ques];
$name_ques=$_POST[name_ques];
$email_ques=$_POST[email_ques];
ในไฟล์ function.php
ไม่เห็นมีค่าตัวแปรส่ง $_POST[title_ques] , $_POST[detail_ques] , $_POST[name_ques] , $_POST[email_ques] ส่งมาเลย ลอกโค้ด function.php เอามาให้ดูหมดยังครับ
ปล.ผมเพิ่งหัด PHP นะเมื่อก่อนใช้แต่ ASP เลยต้องมาเรียนรู้ใหม่ อิอิ
|
 |
 |
 |
 |
Date :
27 เม.ย. 2549 23:13:01 |
By :
พี่ใหญ่ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|