I've looked up how to do this but I just can't seem to get it right. Please tell me how to combine the month, day, and year, into one date to be inserted into the mysql database. My problem is not actually sending information to the database. My problem is I'm sending 3 separate fields (month, day, year) to the database. Please instruct me exactly where to put your recommended codes. Here's my code:
<?php
function register_user($register_data) {
array_walk($register_data, 'array_sanitize');
$fields = '`' . implode('`, `', array_keys($register_data)) . '`';
$data = '\'' . implode('\', \'', $register_data) . '\'';
mysql_query("INSER INTO `users` ($fields) VALUES ($data)");
}
?>
<form action="" method="post">
<ul>
<li>
<select name="month">
<option value="01">January</option>
//all the other month options
</select>
<select name="day">
<option value="01">1</option>
//all the other days
</select
<select name="year">
<option value="2013">2013</option>
//more year options
</select>
</li>
<li>
<input type="submit" name="registrationform" value="Sign up">
</li>
</ul>
</form>
<?php
if (empty($_POST) === false && empty($errors) === true){
$register_data = array(
'Month' => $_POST['month'],
'Day' => $_POST['day'],
'Year' => $_POST['year']
);
register_user($register_data);
//redirect
exit();
?>