Re: problem insert data into mysql
| From: | Cary | Date: | Sat, 16 Nov 2002 01:50:13 +0000 |
| Subject: | Re: problem insert data into mysql | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16983@lists.php.net to get a copy of this message | ||
I'm fairly new to PHP myslef, but I think you need to call the post variable from your form like this:
$_POST["first"], $_POST["last"] etc....
At 10:48 AM 11/16/02, zeus wrote:
I make this script. I have a problem, the data entered in the form wont insert into MYSQL, the database added new row but with blank database. Is there something wrong with the script? because i install phpnuke and i can added new data into mysql. Thanks, i need solve this problem A.S.A.P, with your kind help o PHP-er.... Thanks.. using PHP 4.2 Apache 1.3 ========================code=================== <form action="insert.php" method="post"> First Name: <input type="text" name="first"><br> Last Name: <input type="text" name="last"><br> Phone: <input type="text" name="phone"><br> Mobile: <input type="text" name="mobile"><br> Fax: <input type="text" name="fax"><br> E-mail: <input type="text" name="email"><br> Web: <input type="text" name="web"><br> <input type="Submit"> </form> <?PHP $username="root"; $password=""; $database="belajarPHP"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')"; mysql_query($query); mysql_close(); ?> -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php