|
| |
|
|
laticca8
Posts: 69 Joined: 4/14/2005 Status: offline
|
table won't store new data from submitted form - 8/17/2005 0:09:42
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>"; ?>
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|