I am trying to create a table called "form_data" for the PHP side of this form...
PHP Code:
<?php $con = mysql_connect("LOCALHOST","USERNAME","PASSWORD"); //Replace with your actual MySQL DB Username and Password if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("DATABASE", $con); //Replace with your MySQL DB Name $name=mysql_real_escape_string($_POST['name']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['email']); //This value has to be the same as in the HTML form file $sql="INSERT INTO form_data (name,email) VALUES ('$name','$email')"; /*form_data is the name of the MySQL table where the form data will be saved. name and email are the respective table fields*/ if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "The form data was successfully added to your database."; mysql_close($con); ?>
As a total newbie, I do not know what information is required to create the table in MySQL to be called "form_data" (with consideration to the code you see above) that is supposed to store both "name" and "email" fields, and would appreciate some assistance as to what's required in order to construct the aforesaid table.
As a beginner, I have been dropping data into MySQL versus creating the tables by hand, so I would see your answer clearer if you communicated in
CREATE TABLE form_data
) blah blah blah
terms
If my question is not entirely clear, please ask me to define it for you.
Thanks.
__________________
Currently Reading: Please login or register to view this content. Registration is FREE
|