try before the : if ($submit) this: phpself(); the vars are now declared on a different way in the new phph versions you need to do: if ($_POST[submit]){ and the insert values are also now : echo $_POST[phone]; so check phpinfo(); there are all the vars you need... _______________________________ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : Mark.Snijders@atosorigin.com * :+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -----Original Message----- From: Josh Jones [mailto:bootsec99@yahoo.com] Sent: woensdag 13 november 2002 14:25 To: php-db@lists.php.net Subject: PHP 4 inserting data in MySQL 3.23 I'm running the following setup: Apache 2.0.40-8 MySQL 3.23.52-3 PHP 4.2.2-8.0.5 I have no problems retreiving data from the database and posting it to a website, but I can't insert data from the website to the database via forms or whatever. I'm new to this, but I've triple checked all the permissions and the code - it all works fine from the MySQL command line. I can't find any errors in the logs either, maybe I'm looking in the wrong place. Here's a sample of some testing code: <html> <body> <?php $db = mysql_connect("localhost", "webuser"); mysql_select_db("example",$db); $result = mysql_query("SELECT * FROM mytable",$db); echo "<table border=1>\n"; echo "<tr><td>Name</td><td>Phone</tr>\n"; while ($myrow = mysql_fetch_row($result)) { printf("<tr><td>%s</td><td>%s</td></tr>\n", $myrow[0], $myrow[1]); } echo "</table>\n"; ?> </body> </html> <html> <body> <?php if ($submit) { // process form $db = mysql_connect("localhost", "webuser"); mysql_select_db("example",$db); $sql = "INSERT INTO mytable (name, phone) VALUES ('$name','$phone')"; $result = mysql_query($sql); echo "Thank you! Information entered.\n"; } else{ // display form ?> <form method="post" action="<?php echo $PHP_SELF?>"> Name:<input type="Text" name="name"><br> Phone:<input type="Text" name="phone"><br> <input type="Submit" name="submit" value="Enter information"> </form> <?php } // end if ?> </body> </html> Any help or direction pointing would be appreciated. Thanks __________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php