Note that there are some explanatory texts on larger screens.

plurals
  1. POOnline Booking Page
    primarykey
    data
    text
    <p>I'm trying to create a website for an imaginary hotel where every room has a name ("room of sun", "room of moon", etc.)</p> <p>I'm making the booking page but how should I take the room's names from the database using this code:</p> <pre><code>echo'&lt;select id="roomname" name="roomname" size="1"&gt; '; { include("include/connect.php"); $conn=mysql_connect($HOST, $USER, $PASSWORD); $db_ok=mysql_select_db($DB, $conn); $cam=mysql_query("select Name from room", $conn); $ncam=mysql_num_rows($cam); for ($i=0;$i&lt;$ncam;$i++) { $f=mysql_result($cam,$i,"Name"); echo "&lt;option&gt;$f&lt;/option&gt;"; } mysql_close($conn); } echo '&lt;/select&gt;'; </code></pre> <p>After have selected the room: the booking page has to show you the remaining part of the form with starting and ending dates (with the days when the room is free or rent) and how many people are taking that room.</p> <p>Here comes the problem.. after I select the room, How can I manage in order that the webpage show you the other options and in particular the "select" that loads what's the maximum number of people that can take the room ? (kinda like the "select" I used to load the room's name ^^ )</p> <p>Here there is an example:</p> <pre><code>echo'&lt;select id="Npeople" name="Npeople" size="1"&gt; '; { include("include/connect.php"); $conn=mysql_connect($HOST, $USER, $PASSWORD); $db_ok=mysql_select_db($DB, $conn); $ris=mysql_query("select Nrmax from room where Name='&lt;script type=text/javascript&gt;document.booking.chamber.value&lt;/script&gt;'", $conn); $ros=intval($ris); for ($o=0;$o&lt;$ros;$o++) { $u=mysql_result($ris,$o,"Nrmax"); echo "&lt;option&gt;$u&lt;/option&gt;"; } mysql_close($conn); } echo '&lt;/select&gt;'; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload