Here is the code I have written so far.
<form action="oneroomtable.php" method="post">
Choose which <b>room</b> you would like to check availability for:  
<select name="room">
<option value=>---- Select One ----</option>
<?php
$conn = mysql_connect();
mysql_select_db("test", $conn);
$sql = "SELECT roomnum FROM room";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result))
{
$rooms = $newArray[roomnum];
for ($x=1; $x <= count($rooms); $x++) {
print "\t<option value=\"$rooms\"";
print ($x == $rooms)?" SELECTED":"";
print ">"."\n";
}
echo "$rooms <br>";
}
?>
</select>
<br><br><br>
Select the <b>date</b> and <b>time</b> you would like the booking for.
Then search for room availability:
<br><br>
<?php
include("date_pulldown.class.php");
$date1 = new date_pulldown("fromdate");
$date2 = new date_pulldown("todate");
?>
<p>
<strong>Date From:</strong>
<?php print $date1->output(); ?>
<br><br>
<p>
<strong>Date To:    </strong>
<?php print $date2->output(); ?>
<p>
<strong>Time From:  </strong>
<select name="ftime">
<option value="8:00">8:00
<option value="9:00">9:00
<option value="10:00">10:00
<option value="11:00">11:00
<option value="12:00">12:00
<option value="13:00">13:00
<option value="14:00">14:00
<option value="15:00">15:00
<option value="16:00">16:00
<option value="17:00">17:00
<option value="18:00">18:00
<option value="19:00">19:00
</select>
<br><br>
<p>
<strong>Time To:      </strong>
<select name="ttime">
<option value="8:00">8:00
<option value="9:00">9:00
<option value="10:00">10:00
<option value="11:00">11:00
<option value="12:00">12:00
<option value="13:00">13:00
<option value="14:00">14:00
<option value="15:00">15:00
<option value="16:00">16:00
<option value="17:00">17:00
<option value="18:00">18:00
<option value="19:00">19:00
<option value="20:00">20:00
</select>
<br><br><br>
<center>
<p><input type="submit" name="submit" value="Search Availability"></p>
</center>
I want to be able to generate a table
with the headings of columns as times
eg.
-----------------------------
| |9:00|10:00|11:00|12:00|
----------------------------|
| | |
| | |
| | |
-----------------------------
But I don't know how to convert the string that I get from $_post
into an integer so that I can loop from start time to the end time.
Can anyone help please?
<form action="oneroomtable.php" method="post">
Choose which <b>room</b> you would like to check availability for:  
<select name="room">
<option value=>---- Select One ----</option>
<?php
$conn = mysql_connect();
mysql_select_db("test", $conn);
$sql = "SELECT roomnum FROM room";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result))
{
$rooms = $newArray[roomnum];
for ($x=1; $x <= count($rooms); $x++) {
print "\t<option value=\"$rooms\"";
print ($x == $rooms)?" SELECTED":"";
print ">"."\n";
}
echo "$rooms <br>";
}
?>
</select>
<br><br><br>
Select the <b>date</b> and <b>time</b> you would like the booking for.
Then search for room availability:
<br><br>
<?php
include("date_pulldown.class.php");
$date1 = new date_pulldown("fromdate");
$date2 = new date_pulldown("todate");
?>
<p>
<strong>Date From:</strong>
<?php print $date1->output(); ?>
<br><br>
<p>
<strong>Date To:    </strong>
<?php print $date2->output(); ?>
<p>
<strong>Time From:  </strong>
<select name="ftime">
<option value="8:00">8:00
<option value="9:00">9:00
<option value="10:00">10:00
<option value="11:00">11:00
<option value="12:00">12:00
<option value="13:00">13:00
<option value="14:00">14:00
<option value="15:00">15:00
<option value="16:00">16:00
<option value="17:00">17:00
<option value="18:00">18:00
<option value="19:00">19:00
</select>
<br><br>
<p>
<strong>Time To:      </strong>
<select name="ttime">
<option value="8:00">8:00
<option value="9:00">9:00
<option value="10:00">10:00
<option value="11:00">11:00
<option value="12:00">12:00
<option value="13:00">13:00
<option value="14:00">14:00
<option value="15:00">15:00
<option value="16:00">16:00
<option value="17:00">17:00
<option value="18:00">18:00
<option value="19:00">19:00
<option value="20:00">20:00
</select>
<br><br><br>
<center>
<p><input type="submit" name="submit" value="Search Availability"></p>
</center>
I want to be able to generate a table
with the headings of columns as times
eg.
-----------------------------
| |9:00|10:00|11:00|12:00|
----------------------------|
| | |
| | |
| | |
-----------------------------
But I don't know how to convert the string that I get from $_post
into an integer so that I can loop from start time to the end time.
Can anyone help please?
Comment