Date format from form help.
Posted: Wed Aug 15, 2007 12:28 pm
feyd | Please use
however the following is still produced:
The problem with this is that all the month values need to be in a two digit format for insertion into my DB.
I'm sure anyone who actually knows PHP knows the solution to this, I'm just learning. I have checked the manual thinking that number_format would be where the solution lies, but appearantly it's not.
Any help given here is much appreciated.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello, I am trying to use an array to create a drop down menu populaterd with month names. The Keys to my array are 0-12. When the HTML is created for this the keys in my array become the values in my drop down menu. This gives me the values of 0-12 (zero being the default which will in turn create an error). The problem is that to insert a date into my DB I need a month value with two digits. I tried to create the array as such:Code: Select all
// Make the months array.
$months = array (00=>"",'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August','September', 'October', 'November', 'December');Code: Select all
<select name="month">
<option value="0"></option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
I'm sure anyone who actually knows PHP knows the solution to this, I'm just learning. I have checked the manual thinking that number_format would be where the solution lies, but appearantly it's not.
Any help given here is much appreciated.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]