We have finally figured out how to insert a date via drop-down menus into our database. But in order to error proof our form we want the selected date to be saved when the user is returned to complete the form properly. Currently the current date is displayed when the user is filling out the form. If the user misses a field and has already selected a different date we want that date to remain in the drop-down menu when they are sent back to the form. Also we concatenate datemo,dateyr,dateday so that these three variables are inserted into the articledate field in the database. Please help us, we are verrry confused.

Here is our code for the drop-down date menu in the form file:
PHP Code:
<select name='datemo'>\n";
for (
$n=1;$n<=12;$n++)
{
echo " 
<option value=$n\n";
if (
$todaymo == $n)
{
echo " 
selected";
}
echo "
$monthname[$n]\n";
}
echo "
</select>";
$todayday = date("d",$today);
echo "
<select name='dateday'>\n";
for (
$n=01;$n<=31;$n++)
{
echo "
<option value=$n";
if (
$todayday == $n )
{
echo " 
selected";
}
echo "
$n\n";
}
echo "
</select>\n";
$startyr = (date("Y", $today)-1);
echo "
<select name='dateyr'>\n";
for (
$n=$startyr;$n<=$startyr+1;$n++)
{
echo "
<option value=$n";
if (
$startyr+1 == $n )
{
echo " 
selected";
}
echo "
$n\n";
}
echo "
</select
Here is the processing file:

PHP Code:
<?php
//if any fields are empty, send user back
$articledate $_POST['dateyr'].'-'.$_POST['datemo'].'-'.$_POST['dateday'];
if((
$title == "") || ($content == ""))
{
$url "urltoformfile.php?articledate=$articledate";
$url.="&title=$title&content=$content&category=$category&error=1";

header("Location:$url");

exit;
//stop the script at this point, do not proceed to insert
}
?>