Hi All.
I have a form with two input fields, namely valid_from and valid_to. just, the user must enter dates respectively... when he/she clicks submit, these dates are entered into the database as they where entered in the form. But now my problem is, in the database, validTo is not entered is not recorded, it records the same date for both fields which is validFrom, so for both validFrom and validTo it records validFrom. Can anyone help me with the separation here. Thank you in advance
here's my code
switch ($_GET['operation']) {
case 'I':
$tempFrom = explode("-", $_POST['validFrom']);
$tempTo = explode("-", $_POST['validTo']);
list($day, $month, $year) = $tempFrom;
list($day, $month, $year) = $tempTo;
//$validFrom = list($day, $month, $year);
$sql ='INSERT INTO polls (
name,
text,
choice1,
choice2,
choice3,
choice4,
choice5,
validFrom,
validTo,
active,
ins_TS
) VALUES (
"'.mysql_real_escape_string($_POST['name']).'",
"'.mysql_real_escape_string($_POST['text']).'",
"'.mysql_real_escape_string($choice1).'",
"'.mysql_real_escape_string($choice2).'",
"'.mysql_real_escape_string($choice3).'",
"'.mysql_real_escape_string($choice4).'",
"'.mysql_real_escape_string($choice5).'",
"'."$year-$month-$day".'",
"'."$year-$month-$day".'",
"'.mysql_real_escape_string($active).'",
"'."$year-$month-$day".'"
)';