I've taken a look at the DB code you sent me, and have adjusted it below.
Just copy this to your fmhookpreemail.inc.php file (replacing the current contents), and make the appropriate changes for database connection, and you should be fine:
Things to note:
$con = mysql_connect("host","username","password");
Error('database','Could not connect: ' . mysql_error()); /* this also exits the script */
$name = mysql_real_escape_string($aCleanedValues['name'],$con);
$lastname = mysql_real_escape_string($aCleanedValues['lastname'],$con);
$email = mysql_real_escape_string($SPECIAL_VALUES['email'],$con);
$sql="INSERT INTO e9 ('name', 'lastname', 'email')
Error('database','Insert failed: ' . mysql_error()); /* this also exits the script */
- Your original query was not correct, so I've fixed that.
- Your form fields are in FormMail arrays. Most of them are in an array called $aCleanedValues, some are in $SPECIAL_VALUES as they are FormMail special fields.
- Generally, the only two special fields you'll be interested in retrieving are "email" and "realname": $SPECIAL_VALUES['email'] and $SPECIAL_VALUES['realname'] .
- These two arrays contain sanitized data - this means FormMail has cleaned the data from hacks and dangerous strings that might be attacks.
- Each field you put in the MySQL query must be escaped with a called to "mysql_real_escape_string" (otherwise certain inputs can cause the query to fail).