Jump to content

3 drop down menus - creating a timestamp from time values in the menus???


PC Nerd

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.