hstandeffer hstandeffer - 3 months ago 9
SQL Question

Incorrect date value: '1' for column "" at row 1

I'm aware that there are plenty of other posts similar to this one, however, I know that my problem doesn't lie with the formatting of the date, because mine is already in "yy-mm-dd" format and is correct. I am having trouble inserting an html form into my database due to the a few input fields. These input fields are regular text inputs with a jquery datepicker where you can select the date and these inputs simply have a class of "datepicker" to identify which one. Here's the code and I'd appreciate any help.

$hire_date = isset($_POST['hire_date']);
$vacation_accrual_date = isset($_POST['vacation_accrual_date']);
$date_of_birth = isset($_POST['date_of_birth']);
$date_terminated = isset($_POST['date_terminated']);


You can do this with a ternary test:

$hire_date = isset($_POST['hire_date']) ? $_POST['hire_date'] : <some other date>;

A ternary is a short form conditional check which reads like this:

test ? true result : false result;