JBLC
08-22-2007, 11:17 PM
Hello
If someone could help me out with this problem it would be appreciated.
I am trying to insert into my database a single date entry generated from three select boxes within a form. The select boxes give the options of day, month and year in the format of 01 March 2007 and each select box has the id of 'ind_date'. The corresponding database column is type DATE.
The code I am currently using is
$ind_date = '';
foreach($_POST['ind_date'] as $value) {
$ind_date .= $value . ' ';
}
$ind_date = trim($ind_date);
$ind_date = $_POST['ind_date'][0] . '' . $_POST['ind_date'][1] . '' . $_POST['ind_date'][2];
in association with the following query
$query = "INSERT INTO opsv10 (first_name, last_name, company, position, registered, ind_date) VALUES ('$fn', '$ln', '$cn', '$pos', NOW(), '$ind_date')";
but this keeps returning the following error
"Invalid argument supplied for foreach()"
All suggestions welcome.
Thanks
JBLC
If someone could help me out with this problem it would be appreciated.
I am trying to insert into my database a single date entry generated from three select boxes within a form. The select boxes give the options of day, month and year in the format of 01 March 2007 and each select box has the id of 'ind_date'. The corresponding database column is type DATE.
The code I am currently using is
$ind_date = '';
foreach($_POST['ind_date'] as $value) {
$ind_date .= $value . ' ';
}
$ind_date = trim($ind_date);
$ind_date = $_POST['ind_date'][0] . '' . $_POST['ind_date'][1] . '' . $_POST['ind_date'][2];
in association with the following query
$query = "INSERT INTO opsv10 (first_name, last_name, company, position, registered, ind_date) VALUES ('$fn', '$ln', '$cn', '$pos', NOW(), '$ind_date')";
but this keeps returning the following error
"Invalid argument supplied for foreach()"
All suggestions welcome.
Thanks
JBLC