0

It is supposed to show up details of a room selected, but the first record in database is always displayed. The link is incorrect too..

http://test/action/roomDetail.php?roomID=

The value is missed...

ROOM:

 <table border="0">   
    <tr>
    <td>
    <p>
        <label for="room">選擇房間</label>
        <select name="roomID">
        <?php  
          do {
            printf('<option value="%s">%s</option>', $row_rsRoom['roomID'], $row_rsRoom['roomID']);
          } while ($row_rsRoom = mysql_fetch_assoc($rsRoom));
        ?>        
        </select>
    </p>
    </td>
    <td>   
    <?php printf('<a href="action/roomDetail.php?roomID=%s">詳情</a>',$row_rsRoom['roomID']);
    ?>
    </td>    
    </tr>  
    </table>

DETAILS:

<?php require_once('../../config/conn.php'); 
$roomID=$_GET['roomID'];
$sql="SELECT * FROM roomBooking where roomID = '$roomID'";
$rs=mysql_query($sql,$conn);
$row_rs = mysql_fetch_assoc($rs);
$count=mysql_num_rows($rs);
$roomID=$row_rs['roomID'];
$bookingDate=$row_rs['bookingDate'];
$startTime=$row_rs['startTime'];
$endTime=$row_rs['endTime'];
$numberOfPeople=$row_rs['numberOfPeople'];
?>
...
<h2>房間: <?php echo $roomID ?></h2>
    </header>
    <p>日期: <?php echo $bookingDate ?></p>
    <p>開始時間: <?php echo $startTime ?></p>
    <p>結束時間: <?php echo $endTime ?></p>
    <p>使用房間人數: <?php echo $numberOfPeople ?></p>

Edited by pyTony: fixed formating

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Zagga
0

Hi,

After a very brief look, your link shows a href="action/roomDetail.php?roomID=%s"
What is %s and where is it being defined?

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.