I'll add to what the others have already said. As was already mentioned, you
need to create three dropdown fields for the birthdate: year, month and day.
I do this by setting up arrays for each field that offers valid date
choices.
$year[2000] = 2000;
$year[2001] = 2001;
$year[2002] = 2002;
etc...
$month['January'] = 01;
$month['February'] = 02;
$month['March'] = 03;
etc...
$day[1] = 01;
$day[2] = 02;
$day[3] = 03;
etc...
I use these arrays with a simple function to set up the dropdown form
elements that stores the selected results in another array: $realdate. When
the form is submitted, I simply stitch the date together into a valid MySQL
DateTime format of YYYY-MM-DD using the values stored in the $realdate
variable...
$realdate['year']."-".$realdate['month']."-".$realdate['day'];
This would insert the date as: 2003-05-21
Monty
> From: [EMAIL PROTECTED] (Vicky)
> Newsgroups: php.general
> Date: Sat, 31 May 2003 15:05:43 +0100
> To: "PHP List" <[EMAIL PROTECTED]>
> Subject: 3 entries going into 1 field
>
> Hi,
>
> I have a registration form, but I would like to add a Date of Birth section.
> Now, because of the different formats of writing it I want to have 3 seperate
> drop down boxes, Date, Month and Year.
>
> However, I then want those 3 dropdowns to go into one field in a mySQL
> database, in DD/MM/YYYY format.
>
> How can I acheive this, in simple language as I'm a newbie to this stuff ^_~
>
> Thanks!
> Vicky
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php