Re: PHP Forms

From: Date: Mon, 25 Feb 2002 19:29:43 +0000
Subject: Re: PHP Forms
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86141@lists.php.net to get a copy of this message
On Tuesday 26 February 2002 02:31, Chiew, Richard wrote: > I have the following php code to asks for a new student to fill out a > registration form. Using php, take what the user enters and put it into > the "students" table. But when i select * from students in mysql, it > didn't show, why? > > <HTML> > <BODY bgColor=#ffffff> > <?php > if ($submit) { > // process form > $db = mysql_connect ("localhost", "root", "mollier"); > $select=mysql_select_db ("mydb"); > $sql = "INSERT INTO students > (student_id, firstname,lastname, address) VALUES > ('$student_id', '$firstname', '$lastname', > '$address')"; > $result = mysql_query($sql); > echo "Thank you! Information entered.\n"; Try adding some debug code. Look at the examples in the manual chapter "MySQL functions". echo $sql to see what it contains. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Your picture of the world often changes just before you get it into focus. */

« previous php.general (#86141) next »