|  | 
	                
  
    | 
	 
        ช่วยด้วย parse error syntax error unexpected t_string ขึ้นใส่ ; ก็แล้วยังไงไม่ได้     |  
    |  |  
 
              
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (PHP) 
 if ($REQUEST_METHOD == "POST") {
$att_to = "[email protected], [email protected]";
	$to = stripslashes($att_to);
	$subject =" Booking From Website xxxxx.com";
	$from = "\"$name\" <$email>";
	$headers = "From: $from\nContent-type:text/html; charset=windows-874\n";
	$msg = "Name: $name<br>E-mail: $email<br>Tel: $tel<br><br>
	Check-In Date :  $date_in  <br>  (มัน error บรรทัดนี้ครับช่วยดูหน่อยได้ใหมครับ)
Detail :<br> 
------------------------------------------------------------------------------------------------------------------<br>
$detail<br>
------------------------------------------------------------------------------------------------------------------<br>
Total Nett Price  : $sum <br>
------------------------------------------------------------------------------------------------------------------<br>
<br>Comment: <br>";
		}
 |  
              | 
 ประวัติการแก้ไข
 2013-05-10 15:18:55
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 15:18:30 | By :
                            teez1232002 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ยังไม่ได้อ่ะครับ มันยัง ขึ้น  parse error syntax error unexpected t_string  ชี้ไปบรรทัดเดิมอยู่เลย 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 15:24:09 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | เอาโค๊ดเต็มๆมาดูหน่อย 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 15:57:32 | By :
                            teez1232002 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอโค๊ดเต็มๆ หรือ error เต็มๆ ได้รึเปล่าครับ จะได้รู้ว่าเป็นเพราะบรรทัดไหน บางทีอาจจะเป็นข้อผิดพลาดจากฟังก์ชั่นที่ include เข้ามาก็ได้ ^^"
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 15:58:23 | By :
                            Naizan |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ปกติมันต้องแจ้งว่า line ไหน file ไหนด้วย ^^" 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 15:59:46 | By :
                            Naizan |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (PHP) 
 <? include("booking/dati/dati_connessione.php");
$ann = date("Y"); 
$conn = mysql_connect($PHPR_DB_HOST,$PHPR_DB_USER,$PHPR_DB_PASS);
if (!$conn) die ("No Connect  My SQL");
mysql_select_db($PHPR_DB_NAME) or die ("No Connect".$PHPR_DB_NAME);  function redirect($url, $time = 0) {
	$str = "<script language=\"javascript\">\n";
	$str .= "<!--\n";
	if ($time > 0) $str .= "setTimeout(\"redir()\", $time);\n";
	else $str .= "redir();\n";
	$str .= "function redir() {\n";
	$str .= "location.href = '".$url."';\n";
	$str .= "}\n";
	$str .= "//-->\n";
	$str .= "</script>\n";
	return $str;
}
if ($REQUEST_METHOD == "POST") {
$att_to = "[email protected], [email protected]";
	$to = stripslashes($att_to);
	$subject =" Booking From Website xxxxx.com";
	$from = "\"$name\" <$email>";
	$headers = "From: $from\nContent-type:text/html; charset=windows-874\n";
	//$msg = "Name: $name<br>E-mail: $email<br>Tel: $tel<br><br>
Check-In Date : $date_in <br>
Detail : <br>
------------------------------------------------------------------------------------------------------------------<br>
$detail<br>
------------------------------------------------------------------------------------------------------------------<br>
Total Nett Price  : $sum <br>
------------------------------------------------------------------------------------------------------------------<br>
<br> Comment: <br> 
"//.nl2br($comment);
	//mail($to, $subject, $msg, $headers);
	//e-mail to customer
		$subject ="Thank you for your booking xxxxx Resort";
		$msg2 = "
Dear $name,
Thank you for your booking xxxxx Resort
Check-In Date :  $date_in  
Detail :
------------------------------------------------------------------------------------------------------------------
$detail
------------------------------------------------------------------------------------------------------------------
Total Nett Price  : $sum
------------------------------------------------------------------------------------------------------------------
Please kindly transfer money to our bank account as below details. We can accept payal at [email protected]
Krungsri Bank Office Seri Center
Account No. xxx-x-xxxxx-xx
Account Name xxxx xxxx. 
Account Type saving
To guarantee your room please make your payment and fax pay-in slip to fax number xxxxxx or e-mail to [email protected] within 3 days from the date of booking.
Thank you for Booking at xxxxx.
Tel. xxxxxx \n";
		//$from = "From: $email\nReply-To: [email protected]\nReturn-Path: [email protected]";
		//mail(strtolower($email) , $subject , $msg2 , $from);
	//echo redirect("pay.php");
	exit;	
}
?>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
<link rel="stylesheet" href="pattstyle.css" type="text/css">
<style type="text/css">
<!--
body {
	background-image: url(images/bgg2.jpg);
}
-->
</style>
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td>
      <?include("head.php") ;?>
    </td>
  </tr>
  <tr> 
    <td valign="top" background="images/tab.jpg">
      <p> </p>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="88%" valign="top"><br>
            <img src="images/Reservation-Prices.gif"> 
            <table width="100%" border="0" cellspacing="3" cellpadding="10" class="thai8">
              <tr> 
                <td valign="top"> 
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="10" bgcolor="#FFFFFF">
              <tr valign="top"> 
                <td colspan="3">
                  <?include("room.php") ;?>
                  <div align="center"><br>
                    <br>
                  </div>
                  <table width="900" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="#FFCC33">
                    <tr> 
                      <td width="100%" colspan="4" valign="top" bgcolor="#FFFFCC"> 
                        <p class="thai8 style26"><form method="post" action="<?= $PHP_SELF; ?>" name="cont_form">
                          <div align="center">
                            <table width="90%" border="0" cellspacing="0" cellpadding="3">
                              <tr> 
                                <td colspan="4" class="thai8"><strong>Booking 
                                  detail </strong></td>
                              </tr>
                              <tr> 
                                <td colspan="4" class="thai8"><strong>Date In 
                                  <? $q1= "SELECT * FROM periodi$ann where idperiodi ='$s_date'";
$re1 = mysql_query($q1) or die(mysql_error()); 
$ro1= mysql_fetch_array($re1); echo"$ro1[datainizio] "?>
                                  <input name="date_in" type="hidden" value="<?=$ro1[datainizio]?>" />
                                  </strong></td>
                              </tr>
                              <tr> 
                                <td width="48%" bgcolor="#99CC66" class="thai8"> 
                                  <div align="left" class="style1"> Room Type 
                                  </div>
                                </td>
                                <td width="18%" bgcolor="#99CC66" class="thai8"> 
                                  <div align="left" class="style1"> Cost</div>
                                </td>
                                <td width="18%" bgcolor="#99CC66" class="thai8"> 
                                  <div align="left" class="style1"> Room</div>
                                </td>
                                <td width="16%" bgcolor="#99CC66" class="thai8"> 
                                  <div align="left"><font color="#FFFFFF">Total 
                                    Price</font></div>
                                </td>
                              </tr>
                              <? foreach ($nroom as $key => $value)
						{
						$ppid = explode(",",$key);
						$type = $ppid[0];
						$amount = $ppid[1];
						$nightin = $ppid[2];
						$num = $value; 
						if ($num !='0') {  ?>
                              <tr bgcolor="#FFFFFF"> 
                                <td class="thai8" width="48%"> 
                                  <?=$type?>
                                </td>
                                <td class="thai8" width="18%"> 
                                  <? echo "$amount / $nightin Nights"; ?>
                                </td>
                                <td class="thai8" width="18%"> 
                                  <?=$num?>
                                  <div align="right"></div>
                                </td>
                                <? $total = $num *$amount;?>
                                <td class="thai8" width="16%"> 
                                  <?=$total?>
                                  <? $detail .= "
								  Room type: $type       Cost: $amount / $nightin Nights         |     $num Rooms     |   Total :$total
								";?>
                                  <div align="left"></div>
                                </td>
                              </tr>
                              <? $sum +=$total; }}?>
							   <?=$sum32 = $sum; ?>
                              <tr> 
                                <td colspan="3" bgcolor="#99CC66" class="thai8"> 
                                  <div align="right"><font color="#FFFFFF"><strong>Total 
                                    Nett Price : </strong></font></div>
                                </td>
                                <td bgcolor="#99CC66" class="thai8" width="16%"> 
                                  <div align="left"><font color="#FFFFFF"> 
                                    <?=$sum?>
                                    <input name="detail" type="hidden" value="<?=$detail?>" />
									<input name="sum" type="hidden" value="<?=$sum?>" />
									
                                    </font></div>
                                </td>
                              </tr>
                            </table>
                          </div>
                          <div align="center">
                            <p> </p>
                            <table width="90%"  border="0" cellpadding="5" cellspacing="1" class="thai8">
                              <tr bgcolor="#99CC66"> 
                                <td colspan="2"><b><font color="#FFFFFF">Secure 
                                  Reservation Request Form</font></b></td>
                              </tr>
                              <tr bgcolor="#FFFFFF"> 
                                <td width="28%">Name</td>
                                <td width="72%"> 
                                  <input name="name" type="text" class="infoBoxContent" size="35"onfocus="if (this.value=='your name'){this.value='';};return false;" onBlur="if (this.value==''){this.value='your name';return false;}">
                                  <font color="#990000">*</font> </td>
                              </tr>
                              <tr bgcolor="#FFFFFF"> 
                                <td width="28%">Email</td>
                                <td> 
                                  <input name="email" type="text" class="infoBoxContent" size="35" onFocus="if (this.value=='e-mail'){this.value='';};return false;" onBlur="if (this.value==''){this.value='e-mail';return false;}">
                                  <font color="#990000">*</font></td>
                              </tr>
                              <tr bgcolor="#FFFFFF"> 
                                <td width="28%">Phone</td>
                                <td> 
                                  <input name="tel" type="text" class="infoBoxContent" size="35" onFocus="if (this.value=='phone'){this.value='';};return false;" onBlur="if (this.value==''){this.value='phone';return false;}">
                                  <font color="#990000">*</font></td>
                              </tr>
                              <tr bgcolor="#FFFFFF"> 
                                <td width="28%"> </td>
                                <td> 
                                  <textarea name="comment" cols="33" class="infoBoxContent" onFocus="if (this.value=='comment'){this.value='';};return false;" onBlur="if (this.value==''){this.value='comment';return false;}"></textarea>
                                </td>
                              </tr>
                              <tr bgcolor="#FFFFFF"> 
                                <td width="28%"> </td>
                                <td valign="bottom"> 
                                  <div align="left"> 
                                    <input type="image" src="images/reset.jpg" onClick=" return form_reset(this.form);" name="image">
                                    <input name="image" type="image" onClick="return ct_Subm();" src="images/submit.jpg" border="0">
                                  </div>
                                </td>
                              </tr>
                            </table>
                          </div>
                        </form>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td>
      <p class="thai8 style16"> </p>
      <p class="thai8 style16"> </p>
    </td>
  </tr>
  <tr> 
    <td background="images/tab.jpg">
      <div align="center"> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td width="100%" colspan="3">
              <?include("foot.php") ;?>
            </td>
          </tr>
        </table>
      </div>
    </td>
  </tr>
</table>
 Parse error: syntax error, unexpected T_STRING in /home/lilawala/public_html/book_room.php on line 27
 ขึ้นแบบนี้ครับ
 
 |  
              | 
 ประวัติการแก้ไข
 2013-05-10 16:11:10
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 16:10:02 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ให้แก้ไข บรรทัด ต่อไปนี้ 
 026. //$msg                             << เอาเครื่องหมาย คอมเมนต์ ออก ให้เป็น        >>   $msg = "
 034. <br> Comment: <br> ;     << ต้องมี " อยู่ก่อน เครื่องหมาย ; ปิดบบรทัด     >>  <br> Comment: <br> ";
 035. }                                      << ลบ } ออกไป เพราะปิดผิดที่
 036. "//.nl2br($comment);       << ลบเครื่องหมาย " ที่อยู่ด้านหน้าสุด ออก        >>  //.nl2br($comment);
 
 |  
              | 
 ประวัติการแก้ไข
 2013-05-10 16:22:48
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 16:21:25 | By :
                            Naizan |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับ ได้แล้ว แต่มันขึ้น Warning: Invalid argument supplied for foreach() in /home/lilawala/public_html/book_room.php on line 149
 ตัวนี้อ่ะครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 16:30:05 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | foreach ($nroom as $key => $value) 
 ตัวแปร $nroom ไม่มีข้อมูลครับ คือ ไม่ได้เซ็ตค่าเลยมากกว่า
 
 คิดว่าที่คุณต้องการน่าจะเป็นตัวแปรนี้มากกว่า $ro1 คือข้อมูลที่อยู่ในฐานข้อมูล
 
 foreach ($ro1 as $key => $value)
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 16:45:57 | By :
                            Naizan |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอโทษนะครับ มีปัญหาเยอะ พอดีผม ต้องมานั่งแก้โค้ดของ คนเก่าน่ะครับ และผมก็ยังไม่เก่งพอ ขอบคุณที่แนะนำนะครับ 
 ผมเปลี่ยนจาก
 foreach ($nroom as $key => $value)
 
 เป็นตัวนี้แล้ว
 foreach ($ro1 as $key => $value)
 
 ก็ยังขึ้น
 Warning: Invalid argument supplied for foreach() in /home/lilawala/public_html/book_room.php on line 149
 
 ตัวนี้อยู่เลย งานนี้ผมงานเข้าแน่ถ้าไม่ได้ รบกวนอีกทีนะครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 17:01:04 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | การใช้ฟังก์ชั่น foreach () ตัวแปร $ro1 จำเป็นจะต้องมีค่าอยู่จริง
 
 กรณีไม่มีข้อมูลจะทำให้ Error
 
 ให้เช็กก่อนว่า $ro1 มีค่าอยู่จริง ด้วยฟังก์ชั่น empty()
 
 Code (PHP)
 
 if(!empty($ro1)){
     foreach($ro1 as $key => $value){
    }
}
 แต่สำหรับกรณีที่ต้องการวนลูปหลายรายการ
 เป็นการดึงค่ารายการทั้งหมดจากฐานข้อมูล แนะนำให้ใช้ while
 
 โดยเปลี่ยน foreach() เป็น While() และย้ายบรรทัดที่ 129. $ro1= mysql_fetch_array($re1) มาไว้ในฟังก์ชั่น while()
 
 เป็น
 
 Code (PHP)
 
 while($ro1= mysql_fetch_array($re1)){
..
.
.
.
.
.
.
.
.
}
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 20:48:18 | By :
                            Naizan |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ใช้ is_array กับ count เช็คก่อนก็ดีครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-10 22:19:56 | By :
                            ikikkok |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณ ครับ ไม่ขึ้น Warning: แล้ว แต่ไม่มีค่าอะไรขึ้นเลย เด๋วต้องไปดู database ก่อน ยังไงก็ขอขอบคุณครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-11 08:36:42 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | พี่เค้าก็เลยบอกว่า ก่อนหน้านี้มันใช้ได้ แต่พอย้าย Host ใหม่ก็ใช้ไม่ได้เลย ขึ้น error แบบนี้ก่อน
 แรกก่อนเริ่มที่จะแก้ไขมัน ขึ้นแบบ นี้ครับ
 Parse error: syntax error, unexpected T_STRING in /home/lilawala/public_html/book_room.php on line 27
 
 แต่พอแก้ไขตาม คุณ Cyberman  แนะนำ
 มันก็ขึ้นแบบนี้ครับ
 
 Warning: Invalid argument supplied for foreach() in /home/lilawala/public_html/book_room.php on line 149
 ตอนนี้ก็เลยงง เลยครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-17 17:07:43 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | คงต้อง Export ฐานข้อมูลมาลองกันสักตั้ง เพราะถ้าขึ้นแบบนี้ หมายถึงไม่เจอข้อมูลใดๆ น่ะครับ
 
 
 if(!empty($ro1)){
}
 หรือ
 
 
 if(isset($ro1)){
}
 
 ครอบ foreach ดูนะครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-17 17:32:28 | By :
                            Naizan |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ถ้าโค้ดนี้เป็นโค้ดเดิมของคนเก่าทำไว้จริงๆ และเป็นโค้ดที่คุณยังไม่ได้ไปแก้อะไรให้มันเละเทะ ต่อให้เป็นโฮสต์เก่าก็ไม่น่าจะใช้ได้ครับ
 เพราะตัวแปร $nroom มาจากไหนก็ไม่รู้ แม้โฮสต์เก่าจะตั้งค่าอะไรแย่แค่ไหนก็จะมี error แบบเดียวกันครับ
 ลองไปถามคนเก่าให้แน่ใจล่ะครับ ว่าเขาไม่ได้แก้ไขอะไรค้างไว้หรือเปล่า
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-17 20:15:28 | By :
                            cookiephp |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ในความเห็นผม กรณีแบบนี้ คนเก่าต้องรับผิดชอบครับ เพราะถือเป็นโค้ดที่ใช้งานไม่ได้ (ไม่เกี่ยวกับโฮสต์แน่นอน) 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-17 20:16:14 | By :
                            cookiephp |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ผมไม่แน่ใจว่ามันเป็นยังแน่ ไม่รู้ว่าเพราะย้าย Host หรือเปล่า ลอง export database มารันเครื่องตัวเอง เอาโค้ดทั้งหมดมา รันบนเครื่องตัวเอง แล้วแก้โค้ด ตาม
 
  ตอบความคิดเห็นที่ : 7 เขียนโดย : Naizan เมื่อวันที่ 2013-05-10 16:21:25 
 รายละเอียดของการตอบ ::
 แต่ยังไม่ได้แก้ตัวนี้ที่คุณ Cyberman แนะนำ
 
  ตอบความคิดเห็นที่ : 9 เขียนโดย : Naizan เมื่อวันที่ 2013-05-10 16:45:57 
 รายละเอียดของการตอบ ::
 ก็สามารถใช้ได้ ดึงทุกอย่างปกติ ก็เลยเอา โค้ด ไฟล์ด้วยนี้ ใส่แทน ตัวเดิมที่อยู่บน server ปรากฏ ซะงั้น ขึ้น error  
Warning: Invalid argument supplied for foreach() in /home/lilawala/public_html/book_room.php on line 149  
ได้ยังไง งง ครับ 
 
ผมก็เลยไปหาเมล์เก่าที่คนก่อนเค้าส่งมาตอนที่ถามเค้าว่าทำไมมันใช้ไม่ได้  
เค้าบอกว่า " 
เพราะว่า โฮสต์ใหม่ ตั้งค่า register global = off
 
แต่ host เก่า มันจะตั้ง register global = on 
 
ทำให้ใช้ พวกนี้ไม่ได้ 
$f_date = $s_date + $nightin;
 
ต้องใช้ $_POST รับเข้ามา 
$s_date = $_POST['s_date']; 
$nightin = $_POST['nightin']; 
$f_date = $s_date + $nightin; "
 
บอกมาเท่านี้ครับ
 
T_T
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-18 09:55:10 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | แสดงว่า $nroom  เป็นค่าที่ส่งผ่านมาแบบ 1ใน 3 นี้มั้งครับ $_POST, $_GET, $_SESSION 
 ที่เครื่องตัวเอง(localhost) ลองใช้คำสั่งแสดงค่านี้ดูครับ
 
 
 echo '<hr>';
echo 'ส่งค่าผ่าน $_SESSION<br>';
echo '<pre>', print_r($_SESSION['nroom'], true), '</pre>';
echo '<hr>';
echo 'ส่งค่าผ่าน $_POST<br>';
echo '<pre>', print_r($_POST['nroom'], true), '</pre>';
echo '<hr>';
echo 'ส่งค่าผ่าน $_GET<br>';
echo '<pre>', print_r($_GET['nroom'], true), '</pre>';
 
 ลองดูครับว่าเป็นค่าที่ส่งผ่านมาแบบไหน แล้วก็แก้ไขให้ตรง เช่น ถ้าส่งผ่าน $_POST ก็ใช้
 
 Code (PHP)
 
 if(isset($_POST['nroom']){
    foreach ($_POST['nroom'] as $key => $value){
   }
}
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-18 12:39:42 | By :
                            Naizan |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอโทษอีกทีนะครับ สงสัยอีกและ โค้ดเดิมเลยครับ พอดีผมเขียน java script
 Code (JavaScript)
 
 
if(empty($_GET['nroom']))
{
echo "
<script>
	alert('No Booking');
	window.location='book_room.php';
</script>";
}
else
{
echo "
<script>
	alert('THANK YOU FOR YOUR BOOKING');
	window.location='select21.php';
</script>";
}
 กะว่าพอกด submit ให้ให้เด้ง ขึ้นมา ตามข้อความที่ใส่
 แต่ไม่รู้ต้องเอาไปใส่ตรงไหนของโค้ด นะครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-23 16:17:29 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ส่วนตัวแล้วคิดว่า การตรวจสอบค่าว่างควรเริ่มตรวจสอบก่อน Submit ครับ เช็กด้วย javascript ง่ายๆ เพื่อแจ้งให้ยูสเซอร์รู้ และกรอกค่าต่อไปไม่ต้องเปลี่ยนหน้า
 
 หลังจาก Submit เพื่อบันทึกข้อมูล จะเช็กอีกทีก็ไม่ผิดกฏแต่ประการใด
 
 
 
 ลองดูการใช้ JavaScript ในการตรวจสอบค่าว่างของ Text Field
 https://www.thaicreate.com/tutorial/javascript-check-null-input-text-field.html
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-23 16:23:40 | By :
                            {Cyberman} |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ความต้องการจริงก็คือ เวลากด Submit  แล้ว ให้ขึ้นอยู่ 2 อย่าง ครับ 1 เช็คค่าว่างว่ามีค่าว่างหรือเปล่า 
 2.กดแล้วถ้าสมบูณ ก็ให้มีข้อความขึ้น ขอบคุณ ประมาณนี้นะครับ แล้วเปลี่ยนไปหน้าที่เราต้องการ ครับ
 
 แต่ไม่รู้ว่าจะเอา Script  ไปใส่ตรองไหนของ โค้ด นะครับ (โค้ดที่ให้ช่วยตอนแรกน่ะครับ)
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-23 16:34:59 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | 1. เช็กค่าว่าง ควรจะอยู่หน้าเดียวกับแบบฟอร์มกรอกข้อมูล ตอนกดส่งข้อมูลให้สร้างฟังก์ชั่นขึ้นมาเช็กก่อน ครับ 2. ข้อความแจ้งขอบคุณ ควรจะแสดงเมื่อบันทึกข้อมูลเรียบร้อยแล้ว
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-23 16:53:03 | By :
                            {Cyberman} |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ไม่ว่าผมจะใส่ดค้ดให้มันเช็คยังไง ตอนกด submit มันก็ขึ้น หน้า url book_room.php อย่างเดียวเลย แล้วก็ไม่มี อะไรเลยที่หน้าเวป นั่งหาว่ามันไปสั่งให้กด submit แล้วไปโผ่ลตรง book_room.php ว่าโค้ดอยู่ตรงไหนก็หาไม่เจอ ช่วยด้วย
 ลองไปเปลี่ยนตรงบรรทัดที่
 254  : Code (PHP)
 
  <input name="image" type="image" onClick="return ct_Subm();" src="images/submit.jpg" border="0">
 
 ตรงonClick ก็ไม่ได้ ครับ
 
 |  
              | 
 ประวัติการแก้ไข
 2013-05-30 15:21:15
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-05-27 14:01:12 | By :
                            somjang |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |