Developer Support »

Inserting form data into a database  (See more user questions)

Hi

Glad the script is doing a job for you!

There isn't a facility in the script to insert data into a database. You
would need to code it yourself to do so.

I can give you a clue, though! All the submitted form values are in the
$_REQUEST array, so for example, the name would be here:

$_REQUEST['name']

...the email would be here:

$_REQUEST['email']

...the comments would be here:

$_REQUEST['comments']

Note that 'name', 'email' and 'comments' are the exact (case sensitive)
names of the fields on your form.

So an example line of code to insert into a database, would be like this:

mysql_query("INSERT INTO contact (name,email,comments) VALUES
('$_REQUEST['name']','$_REQUEST['email']','$_REQUEST['comments']')",$linkid);

In the above code, "contact" is the name of the database table and
(name,email,comments) is the name of the fields in the table, which don't
have to be the same name as the form fields.

I would recommend you put your code in the script after the email is sent.
Put it after this line:

mail($my_email,$subject,$message,$headers);

Hope this is of some help.

Best wishes.

Charles Sweeney
https://formtoemail.com
The world's easiest feedback script!

----- Original Message -----
Sent: Thursday, February 25, 2010 11:14 AM
Subject: FormToEmail script


> Comments: Hi. I have purchased the pro version of the script and
> everything seems to be working well. Great script!
> However, I need the data from my form to be entered into a mysql database
> (or to update info already there). I have tried to insert my code inside
> your script in various places, but cannot get it do what I want. The
> variables *are* passed, because I get emails telling me so, but what am I
> missing? What do I do to insert the data into a database?
> Thanks in advance