Re[4]: [PHP] value passing from html form to php variable.

From: Date: Sat, 01 Jun 2002 16:44:57 +0000
Subject: Re[4]: [PHP] value passing from html form to php variable.
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-100241@lists.php.net to get a copy of this message
On Saturday, June 1, 2002 at 5:35:03 PM, you wrote: > Is there anything I should do to make the php.ini come into effect? I did > put the register_global = On but still got empty values. you may not need to do anything or you may need to restart your http server. Have a look at your phpinfo() page. If it's picking up the php.ini file then it will show it's filename as well as it's path. > <?php > $db = pg_connect("dbname=friends"); > $query = "INSERT INTO friends (id, firstname, surname) values > (nextval('friends_id_seq'), $_POST['firstname'], > $_POST['surname'])"; > $result = pg_exec($db, $query); > if (!$result) { > printf ("ERROR"); > $errormessage = pg_errormessage($db); > echo $errormessage; > exit; > } > printf ("These values were inserted into the database - %s %s", $firstname, > $surname); > pg_close(); ?>> > </body> > </html> Hmm, line 6 of that code would be printf ("ERROR"); but I'll assume that you haven't included the first few lines and that line 6 is actually the pg_exec line. You haven't changed $query as I suggested in a previous message. Change the $query = line to the following... $query = "INSERT INTO friends (id, firstname, surname) values (nextval('friends_id_seq'), ".$_POST['firstname'].", ".$_POST['surname'].")"; -- Stuart

« previous php.general (#100241) next »