Jump to content

Recommended Posts

I have a dropdown box filled with times in a form:

<select name =  "closetime">
<option>Choose One</option>
<option>All Day</option>
<option>7:00 am</option>
<option>8:00 am</option>
<option>9:00 am</option>
<option>10:00 am</option>
<option>11:00 am</option>

How do I convert "closetime" to a time format ($closetime) that I can insert into my database?

I'm assuming that at some point in the code I'll use strtotime, but I'm not sure where...

Inside the option tags?, or after "closetime" has a value?, or after "closetime" is sent to a processing file?

Any ideas? Thanks!

Link to comment
https://forums.phpfreaks.com/topic/258408-converting-a-string-to-time/
Share on other sites

<option value="07:00">7:00am</option> . . . <option value="23:00">11:00pm</option>

 

You might want to set up an array with the values in it, so you can just loop the array to build the <option> list. Just a thought.

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.