Help with scripts to add records to a database

From: Date: Wed, 12 Nov 2003 03:44:58 +0000
Subject: Help with scripts to add records to a database
Groups: php.general 
Request: Send a blank email to php-general+get-169228@lists.php.net to get a copy of this message
I am following the tutorial at http://www.freewebmasterhelp.com/tutorials/phpmysql/ The source code is on the website on the left hand side http://www.freewebmasterhelp.com/static/tutorials/phpmysql/example.zip My software: PHP version 4.3.4 on Windows 2000 MYSQL version 4.0.16 on Windows 2000 Apache version 1.3.29 on Windows 2000 The problem is I cannot get the database to add a new records aside from the auto-increment field. All the other fields are left blank when the add.html is subitted. I have the add.html with the following code exactly the same as the source 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> The insert.php <? include("dbinfo.inc.php"); 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(); ?> Any help would be much appreciated. Regards, Mark

« previous php.general (#169228) next »