PC Nerd Posted December 15, 2007 Share Posted December 15, 2007 Hi, Ive got the following code, and its meant to display the possilbe days hours and minutes within 2 months, and then place it into a timstamp for storage in the database. Im also looking for a way to get the timestamp and turn it back into the 3 menus, using the <option... selected> values. CREATE THE ARRAYS FOR THE DROP DOWN MENUS $Days = array(); $Hours = array(); $Minutes = array(); for($i=time();$i< strtotime('+2 months');$i += 86400) { $day = date("d/m/y - l", $i); $Days[$i] = $day; } for($i = 0; $i < 24;$i++) { $hour = $i * 60 * 60; $Hours[$i] = $hour; } for ($i = 0; $i < 60; $i++) { $Minutes[$i] = $i*60; } DROP DOWN MENUS Start Date: <select name = 'Start_date_day'><?php foreach($Days as $field => $value) { echo "<option value = '".$field."'>".$value."</option>\n";} ?></select> Hour: <select name = 'Start_date_hour'><?php foreach($Hours as $field => $value) { echo "\t<option value = '".$value."'>".$field."</option>\n";} ?></select> Minutes: <select name = 'Start_date_minute'><?php foreach($Minutes as $field => $value) { echo "\t<option value = '".$value."'>".$field."</option>\n";} ?></select> <br><br> Finish date: <select name = 'Finish_date_day'><?php foreach($Days as $field => $value) { echo "<option value = '".$field."'>".$value."</option>\n";} ?></select> Hour: <select name = 'Finish_date_hour'><?php foreach($Hours as $field => $value) { echo "\t<option value = '".$value."'>".$field."</option>\n";} ?></select> Minutes: <select name = 'Finish_date_minute'><?php foreach($Minutes as $field => $value) { echo "\t<option value = '".$value."'>".$field."</option>\n";} ?></select> <br><br> Can Anyone tell me how i am meant to creat the timestamps form these values? at the moment im simply adding the three values together - ie $days + hours + minutes..... but thats on the form handling page. Thanks, PC_Nerd Link to comment https://forums.phpfreaks.com/topic/81769-3-drop-down-menus-creating-a-timestamp-from-time-values-in-the-menus/ Share on other sites More sharing options...
PC Nerd Posted December 15, 2007 Author Share Posted December 15, 2007 ***bump*** Link to comment https://forums.phpfreaks.com/topic/81769-3-drop-down-menus-creating-a-timestamp-from-time-values-in-the-menus/#findComment-415614 Share on other sites More sharing options...
PC Nerd Posted December 15, 2007 Author Share Posted December 15, 2007 ***bump*** does anyoen have any ideas? or do i need to explain it better?? Thanks Link to comment https://forums.phpfreaks.com/topic/81769-3-drop-down-menus-creating-a-timestamp-from-time-values-in-the-menus/#findComment-415873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.