I am really stuck with any idea on how to do this. It is really confusing. Is there any way in PHP that i can select only one day of the week. My scenario is that people are only allowed to make reservations on a Friday. Is there any way i can pull only Friday and use it with date() or strftime()? And use it in drop down boxes(menus)?

Any help will be appreciated.

8 Years
Discussion Span
Last Post by ripper1510

you might want to use an if statement to compare whatever day today is to the string Friday.

for example

$friday = 'Friday';
 if(date(l) == $friday){
//drop down boxes, menus or other code here

You have got the date of friday's date

$pf_time1 = strtotime("next Friday");
$pf_date1 = date("Y-m-d h:i:s", $pf_time1); 
//$pf_date1 = date("Y-m-d 00:00:00",$pf_time1); use if use don't want time only date display

store your date in database check_date column or depends on your logic check

$sql=mysql_query("select check_date from table where check_date=curdate() ")or die("Error: ".mysql_error());


$sql=mysql_query("select check_date from table where check_date=now() ")or die("Error: ".mysql_error());

//do what ever you want 
//use it in drop down boxes(menus)

I think it solves your problem


These are both very good ideas but i just realised what i said. Instead of making only on friday i meant making only for friday. So the client can only make appointments for friday. i.e mon-thurs and sat-sun are not an option. So when they go on the form and select an appointment time it will be put in the database as eg 19 december 2008 12:15(which is a friday) or if they would like to book for next week friday they would select 26 december 2008 16:00 which is also a friday.
I think in short i need drop downs that only show fridays for selection


I have found the solution. Just thought i would let you know what it was. PHP.net helped. Daniweb is amazing though.

print "<select name=\"Start\" size=\"1\">"; 
print "<option value=\"Select Week\" selected>Select Week</option>"; 
for($i=0; $i<=52; $i++){ 
$num = date("d M Y", strtotime('next friday +'.$i.' week')); 
print"<option value=\"{$num}\">{$num}</option> \n"; 
print "</select>";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.