0
<?php

echo'<form method="Post" action="#">
Guest ID <select name="Guestroom" class="span33" >

<option>Selec Guest</option>

<option>1</option>';

error_reporting(0);

require_once('dataconnect.php');

    $query2="SELECT * FROM guest";                          

                  $result2= mysql_query($query2)
                    or die (mysql_error());
                $nrows2 = mysql_num_rows($result2);

                      while($Guest=mysql_fetch_array($result2)){     

?>
    <option name="Guestroom" value="<?php $one=$Guest['Guest_id'];?>">

    <?php echo"".$Guest['firstname'];?>

    </option>

    <br>

    <?php } ?>

    </select>

    <input type="submit" name="retrieve" value="Retrieve Guest I.D information">

    </form>

    <?php


if(isset($_POST['retrieve']))

{

$Guest_room = $one;

}
echo"".$Guest_room;

/*retrieving all data */

$result = mysql_query(" SELECT * FROM guest WHERE Guest_id = '$Guest_room'");

$test = mysql_fetch_array($result);
4

0 回答 0