iPixel Posted June 14, 2008 Share Posted June 14, 2008 Ok long story short... User inputs: Date of Arrival - mm/dd/yyyy Nights of Stay - 1,2,3 The place this is for has a meet & greet option that allows you to meet up with some ppl from the area... and i need to create a radio button choice where if someone lets say selects Aug 15th asn their day of arrival with a 3 day stay... the next page will give them the option to chose from Aug15 Aug16 Aug17 as the day at which they want to do the meet and greet. I practically had the script going but then i realised its really buggy since if someone chooses Aug 31 the script would return Aug31 Aug32 Aug33 instead of Aug 31 Sept 1 Sept 2... The choices are radio buttons.... () Aug 15 () Aug 16 ()Aug 17 Here is my script, please help me make it work properly and also take Leap year into account for February <? if($Month == "01") $Mshow = "Jan"; if($Month == "02") $Mshow = "Feb"; if($Month == "03") $Mshow = "Mar"; if($Month == "04") $Mshow = "Apr"; if($Month == "05") $Mshow = "May"; if($Month == "06") $Mshow = "Jun"; if($Month == "07") $Mshow = "Jul"; if($Month == "08") $Mshow = "Aug"; if($Month == "09") $Mshow = "Sep"; if($Month == "10") $Mshow = "Oct"; if($Month == "11") $Mshow = "Nov"; if($Month == "12") $Mshow = "Dec"; $ShowMyDates = $Day; // The Day you chose as arrival day... lets say Aug 15 for($MyDateInc = 0; $MyDateInc < $Nights; $MyDateInc++) { $ShowDate = $ShowMyDates + $MyDateInc; // Increase the Date day by 1 per $Nights of stay ?> <input type="radio" name="mag_date" id="mag_date" value="<? echo $Mshow . ", " . $ShowDate; ?>"><? echo $Mshow . ", " . $ShowDate; ?> <? } Thanks to all in advance. Link to comment https://forums.phpfreaks.com/topic/110206-solved-i-need-a-date-choser/ Share on other sites More sharing options...
Barand Posted June 14, 2008 Share Posted June 14, 2008 try <?php $arrival = '2008-02-28'; $nights = 4; $tval = strtotime($arrival); for ($i=0; $i<$nights; $i++) { $mag = date('M j', strtotime("+$i days", $tval)); echo "<input type='radio' name='mag_date' id='mag_date' value='$mag'> $mag "; } ?> Link to comment https://forums.phpfreaks.com/topic/110206-solved-i-need-a-date-choser/#findComment-565547 Share on other sites More sharing options...
iPixel Posted June 15, 2008 Author Share Posted June 15, 2008 Works Like a charm ! Your a bloody genius Barand ;-) tyvm for the help. Link to comment https://forums.phpfreaks.com/topic/110206-solved-i-need-a-date-choser/#findComment-565705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.