roomID is used to list all record of some room ID, all the record is associated with roomBookingID. When a user clicked "modify", a form is supposed to show. However, a error message shown after I added the red statement.
<?php require_once('../../config/conn.php');
$roomID=$_GET['roomID'];
$sql="SELECT * FROM roomBooking where roomID = '$roomID'";
$room_query_result=mysql_query($sql,$conn);
$row_rs = mysql_fetch_assoc($room_query_result);
$count=mysql_num_rows($room_query_result);
?>
...
<form method="post" action="del_room.php">
<table border="1">
<?php do { ?>
<tr>
<td>
<?php
printf('<input type="checkbox" name="roomID[]" value="%s" />', $row_rs['roomID']);
printf('<input type="hidden" name="roomBookingID" value="%s" />', $row_rs['roomBookingID']);
?>
</td>
<td> <?php echo $row_rs['bookingDate']; ?></td>
<td><?php echo $row_rs['startTime']; ?></td>
<td> <?php echo $row_rs['endTime']; ?></td>
<td><?php echo $row_rs['numberOfPeople']; ?></td>
[COLOR="Red"]<td><?php printf('<a href="roomDetail.php?roomBookingID=%s">modify</a>',$row_rs['roomBookingID']);
?></td> [/COLOR]
</tr>
<?php } while($row_rs = mysql_fetch_assoc($room_query_result)) ?>
</table>
<p>
<input type="submit" value="cancel" />
<input type="reset" value="reset" />
</p>
</form>
...
<?php
if (isset($_GET['roomID'])) {
$SQL = sprintf("SELECT * FROM roomBooking WHERE roomID = '%s'", $_GET['roomID']);
$rs = mysql_query($SQL, $conn) or die(mysql_error());
$row_rs = mysql_fetch_assoc($rs);
// use heredoc syntax to quote a string and store it in variable $form
$form = <<<EOD
<form method="post" action="updateRoom.php">
<div>
<br>
<br>
<p>
<label>
房間
<input type="text" name="roomID" value="%s"/>
</label>
</p>
<p>
<label>
日期
<input type="text" name="bookingDate" value="%s"/>
<input type="button" value="Cal" >
(yyyy-mm-dd)
</label>
</p>
<p>
<label>
開始時間
<input type="text" name="startTime" value="00:00:00"/>(hh-mm-ss)
</label>
</p>
<p>
<label>
結束時間
<input type="text" name="endTime" value="00:00:00"/>(hh-mm-ss)
</label>
</p>
<p>
<label>
使用房間的人數
<input type="text" name="numberOfPeople" value="0"/>
</label>
</p>
<input type="submit" value="確定"/>
<input type="button" value="取消" />
</div>
</form>
EOD;
// Substitute a string value into %s found in $form
printf($form,
$row_rs['roomID'],
$row_rs['bookingDate'],
$row_rs['startTime'],
($row_rs['endTime']),
($row_rs['numberOfPeople'])
);
} // end-if
?>
</body>
</html>