Form input problems

           [php]$vehreg = $_POST["veh_reg"];
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_post["year"];

$date = ($year . ‘-’ . $month . ‘-’ . $day); //<----this part does not work, have tried many routes and canne get it to work because of the date format in sql is USA not UK

$sql = “INSERT INTO daybook_db (veh_date, veh_reg) VALUES (’$date’, ‘$vehreg’)”;
[/php]

Just to check, do the $_POST[‘day’], $_POST[‘month’] and $_POST[‘year’] have valid values? You have:

[php]$_post[“year”][/php]

Which needs to be changed to:

[php]$_POST[“year”][/php]

If this still doesn’t work, could you echo out the query and the result of mysql_error (if the query fails).

All sorted now, two horrid errors on my part;

1st= the POST in wrong case; :o
2nd = no value into primary key! :-\

Thanks jSherz - think i tried my best to be an idiot in this task, I did well. haha

Sponsor our Newsletter | Privacy Policy | Terms of Service