MySQL Forums
Forum List  »  Newbie

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

i appreciate your speedy response. please be patient with me on this. you stated that if i have another script posting it then add $id = $_POST['id']; in your script for each variable.

i only have those two documents involved in this exchange. one is the html form which contains that line <FORM METHOD=POST ACTION="add.php">; the other is the php document "add.php."

so you're saying do something like this to the add.php file?
<?
$DBhost = "Your-MySQL-servers-IP-or-domainname";
$DBuser = "your user name";
$DBpass = "Your Password";
$DBName = "The Name of the Database";
$table = "information";
$id = $_POST['id'];
$name = $_POST['name'];
$email = $_POST['email'];
$opinion = $_POST['opinion'];

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();

again, i'm so sorry, but i am completely new to this. thanks a million!

Options: ReplyQuote


Subject
Written By
Posted
Re: table will not store new data from submitted form
August 16, 2005 11:43PM


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.