MySQL Forums
Forum List  »  Newbie

table will not store new data from submitted form
Posted by: LaTicca Peeples
Date: August 16, 2005 09:52PM

I used a tutorial from www.thescripts.com to walk me through creating an html form, adding a new table to a database, and inserting the submitted form data into the table. See the code in part below.

When I complete the form on my localhost, the "action" page does not "print" the data I input nor are the values stored in the table. I'm certain that there is a working connection because a new row is added with no data other than the "id" which is set to auto increment.

Please advise me on what to do.


<?
$DBhost = "Your-MySQL-servers-IP-or-domainname";
$DBuser = "your user name";
$DBpass = "Your Password";
$DBName = "The Name of the Database";
$table = "information";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");

@mysql_select_db("$DBName") or die("Unable to select
database $DBName");

$sqlquery = "INSERT INTO $table
VALUES('$id','$name','$email','$opinion')";

$results = mysql_query($sqlquery);

mysql_close();

print "<HTML><TITLE> PHP and MySQL </TITLE><BODY
BGCOLOR=\"#FFFFFF\"><center><table border=\"0\"
width=\"500\"><tr><td>";
print "<p><font face=\"verdana\" size=\"+0\"> <center>You
Just Entered This Information Into the
Database<p><blockquote>";
print "Name : $name<p>E-Mail : $email<p>Opinion :
$opinion</blockquote></td></tr></table>
</center></BODY></HTML>";
?>

Options: ReplyQuote


Subject
Written By
Posted
table will not store new data from submitted form
August 16, 2005 09:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.