I am trying to populate a table with times the client has booked an appointment(eg. 10:30AM) so I have a select box with the times of the day starting from 9:00AM to 7:00PM going up in 15minute steps(9:45am, 10:00am).
<select name="times">
<option value="09:00">9:00am</option>
.....
<option value="19:00">7:00pm</option>
</select>
I need to some how delete some of the times that are already stored in the database
would this be like?:
<?php
$times = $_POST['times'];
$dbc = mysqli_connect('localhost', 'root', '', 'salon')
or die('error conneting to mysql');
$query = "SELECT times FROM `clients` WHERE `times` = '$times'";
$result = mysqli_query($dbc, $query);
mysqli_close($dbc);
?>
<select>
<?php
$times = array('09:00','09:15', ..... '19:00');
foreach($times as $time);
while($row = mysql_fetch_array($results)){
if($row = $time){
unset($time);
echo '<option value="$time">$times</option>';
}
else{ echo 'oh no';
}
?>
</select>
well something like that.. anyway I just can't figure it out.
thanks in advance to all help.
P.S I know my code should be more clean and include strip_tags() mysql_real_escape_string(). this is just for the purpose of asking a question