How can i insert three dropdown values in one field into my database for inserting date of birth. I am $dob variable is it ok or not? please help me.
My form is
<form name="" id="order-form" class="smart-form" role="form" action="" method="post" enctype="multipart/form-data">
<tr>
<td><font color="#334D66"> Date of Birth: </td>
<td><select name="birthday">
<option selected></option>
<option>01</option>
<option>02</option>
.
.
</select>
<select name="birthmonth">
<option selected></option>
<option>January</option>
<option>February</option>
.
.
</select>
<select name="birthyear">
<option selected></option>
<option>1999</option>
<option>1998</option>
.
.
</select>
</td>
</tr>
AND my insert code like this
<?php
if(isset($_POST['submit']))
{
$day=$_POST['birthday'];
$month=$_POST['birthmonth'];
$year=$_POST['birthyear'];
$dob = $day.'/'.$month.'/'.$year;
$data =array('username' => $_POST['username'],
'firstname' => $_POST['firstname'],
'lastname' => $_POST['lastname'],
'email' => $_POST['email'],
'homepage' => $_POST['homepage'],
'adress' => $_POST['adress'],
'city' => $_POST['city'],
'province_id' => $_POST['province_id'],
'postcode' => $_POST['postcode'],
'country_id' => $_POST['country_id'],
'phone' => $_POST['phone'],
'dob' => $dob,
'gender' => $_POST['gender'],
'occupation' => $_POST['occupation'],
'fav_quotes' => $_POST['fav_quotes'],
'news' => $_POST['news'],
'newsletter' => $_POST['newsletter'],
'reg_type_id' => $reg_type_id,
'images' => $_POST['images']
);
insert('user', $data);
//echo "Success";
header("Location: paypal-invoice/createandsend.example.php");
}
?>
Thanks In Advance.
you can insert dob in a mysql dababase because mysql accept yyyy-mm-dd format so you should
$year.'-'.$month.'-'.$day
I think it will work for you