Hi there,
it has been awhile since I coded in PHP and I have a little problem that is eating up way too of my energy.
I have a form that is being submitted via the POST method
In the handler.php file, I want to take that information and insert it into the Database.
Easy Huh?
Well I cannot get my statement to insert anything -
Here is my code...
//For security reasons we will now pass each variable through the escape string function to get rid of baddies
$cleanArray = Array();
foreach($_POST AS $key=>$value)
{
$cleanArray['$key'] = mysql_real_escape_string($value);
echo $key." = ".$cleanArray['$key']."<br><br>";
}
print_r($cleanArray);
$timeNow = time();
$insertSQL = "
INSERT
INTO
abstract_demographics
(first_name,last_name,additional_authors,position,credentials,mailing_address_1,mailing_address_2,city,state,zip,country,organization,org_address_1,org_address_2,org_city,org_state,org_zip,org_country,work_phone,home_phone,fax_number,cell_phone,email_address,contact_preference)
VALUES
('{$cleanArray['fName']}','{$cleanArray['lName']}','{$cleanArray['addAuthors']}','{$cleanArray['position']}','{$cleanArray['credentials']}','{$cleanArray['mailAdd1']}','{$cleanArray['mailAdd2']}','{$cleanArray['mailCity']}','{$cleanArray['mailState']}','{$cleanArray['mailZip']}','{$cleanArray['mailCountry']}','{$cleanArray['authorOrg']}','{$cleanArray['orgAdd1']}','{$cleanArray['orgAdd2']}','{$cleanArray['orgCity']}','{$cleanArray['orgState']}','{$cleanArray['orgZip']}','{$cleanArray['orgCountry']}','{$cleanArray['workPhone']}','{$cleanArray['homePhone']}','{$cleanArray['faxPhone']}','{$cleanArray['cellPhone']}','{$cleanArray['email']}','{$cleanArray['method']}')
";
IF(mysql_query($insertSQL))
{
$did = mysql_insert_id();
//header("location: http://mysite.com/DEVELOPMENT/");
PRINT("<br /><br />SQL = $insertSQL");
}//end if
ELSE
{
PRINT("<br /><br /><h3>An Error has Occured!</h3><br /><br /> Details about this error:<br />");
echo mysql_error();
PRINT("<br /><br />SQL = $insertSQL");
}//end else
When I print out the query - the query contains NOTHING, but if I pront out the cleanArray, it contains all the values