only allowing available dates to be selected in a drop down menu? php mysql html

Gotigers

New Member
On my form that users fill in and their data is sent to mysl database, there is a drop down menu which includes dates. what i need to do is make the drop down menu so that it only includes dates that are available. so i can query the database to find a certain date and if there is already an event for that date, then i can somehow take that date out from the drop down menu? i can imagine this being lengthy and complicated and wondered if anyone had ideas of how to do this effectively? there are a lot of dates, like two months worth, i dont really want to have to make a query for each date but im not entirely sure what else i could do. thanks for any replies.i havent TRIED anything yet, have only had ideas. i was just wondering if anyone had any better ideas which werent getting every available date FROM mysql but instead just query dates from mysql that arent available then take that date away from the drop down? cutting out the rest of the input of the form -html:\[code\]<div class="title"><h1>Booking Private Hire</h1></div></head><body><form name="second" onsubmit="return validateFormOnSubmit(this)" method="POST" action="thirdform.php"><table summary="Second form"><tr><td><label for="date">Date:</label></td><td><select name="date" size="1"><option value="http://stackoverflow.com/questions/14540719/01-03-13">01-03-13</option><option value="http://stackoverflow.com/questions/14540719/02-03-13">02-03-13</option><option value="http://stackoverflow.com/questions/14540719/03-03-13">03-03-13</option><option value="http://stackoverflow.com/questions/14540719/04-03-13">04-03-13</option><option value="http://stackoverflow.com/questions/14540719/05-03-13">05-03-13</option><option value="http://stackoverflow.com/questions/14540719/06-03-13">06-03-13</option><option value="http://stackoverflow.com/questions/14540719/07-03-13">07-03-13</option><option value="http://stackoverflow.com/questions/14540719/08-03-13">08-03-13</option><option value="http://stackoverflow.com/questions/14540719/09-03-13">09-03-13</option><option value="http://stackoverflow.com/questions/14540719/10-03-13">10-03-13</option><option value="http://stackoverflow.com/questions/14540719/11-03-13">11-03-13</option><option value="http://stackoverflow.com/questions/14540719/12-03-13">12-03-13</option><option value="http://stackoverflow.com/questions/14540719/13-03-13">13-03-13</option><option value="http://stackoverflow.com/questions/14540719/14-03-13">14-03-13</option><option value="http://stackoverflow.com/questions/14540719/15-03-13">15-03-13</option><option value="http://stackoverflow.com/questions/14540719/16-03-13">16-03-13</option><option value="http://stackoverflow.com/questions/14540719/17-03-13">17-03-13</option><option value="http://stackoverflow.com/questions/14540719/18-03-13">18-03-13</option><option value="http://stackoverflow.com/questions/14540719/19-03-13">19-03-13</option><option value="http://stackoverflow.com/questions/14540719/20-03-13">20-03-13</option><option value="http://stackoverflow.com/questions/14540719/21-03-13">21-03-13</option><option value="http://stackoverflow.com/questions/14540719/22-03-13">22-03-13</option><option value="http://stackoverflow.com/questions/14540719/23-03-13">23-03-13</option><option value="http://stackoverflow.com/questions/14540719/24-03-13">24-03-13</option><option value="http://stackoverflow.com/questions/14540719/25-03-13">25-03-13</option><option value="http://stackoverflow.com/questions/14540719/26-03-13">26-03-13</option><option value="http://stackoverflow.com/questions/14540719/27-03-13">27-03-13</option><option value="http://stackoverflow.com/questions/14540719/28-03-13">28-03-13</option><option value="http://stackoverflow.com/questions/14540719/29-03-13">29-03-13</option><option value="http://stackoverflow.com/questions/14540719/30-03-13">30-03-13</option><option value="http://stackoverflow.com/questions/14540719/31-03-13">31-03-13</option></select></td></tr><tr><td>&nbsp;</td><td><input name="Continue" value="http://stackoverflow.com/questions/14540719/Continue" type="submit" ></td><td>&nbsp;</td></tr> </table></form> </body></html>\[/code\]at the moment i have a hire table which looks like:hireid int(5)
customerid int(5)
driverid int(5)
time time
endtime time
date varchar(8)
length int(11)
pickuplocation varchar(25)
destination varchar(25)
useofbus varchar(20)
numberofpeople int(16)
cost decimal(10,2)
day int(2)
month int(2)
year int(2)
payment varchar(6)
information varchar(6)
 
Back
Top