X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A34DE310B84 for ; Tue, 1 Jul 2003 08:02:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 05069-01 for ; Tue, 1 Jul 2003 05:02:35 -0300 (ADT) Received: from ds9.quadratec-software.com (ds9.quadratec-software.com [62.23.102.82]) by svr1.postgresql.org (Postfix) with ESMTP id F2176310B76 for ; Tue, 1 Jul 2003 05:02:33 -0300 (ADT) Received: from spade.orsay.quadratec.fr (smtpserver [172.16.14.14]) by ds9.quadratec-software.com (8.11.3/8.11.3) with ESMTP id h6182WI31276 for ; Tue, 1 Jul 2003 10:02:33 +0200 Received: from hotshine (hotshine.orsay.quadratec.fr [172.16.200.100]) by spade.orsay.quadratec.fr (Switch-2.1.0/Switch-2.1.0) with SMTP id h6182VU17727 for ; Tue, 1 Jul 2003 10:02:31 +0200 (CEST) From: "philip johnson" To: Subject: Re: PHP form Creates Blank DB entries Date: Tue, 1 Jul 2003 10:06:37 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal X-Archive-Number: 200307/1 X-Sequence-Number: 2113 pgsql-php-owner@postgresql.org wrote: > At 12:16 PM 6/30/03, Michael Hanna wrote: >> // error checks on form submission go here >> // generate and execute a query >> $query = "INSERT INTO addressbook VALUES >> (nextval('addressbook_id_seq'), '$name', '$address', '$tel', >> '$email')"; $result = pg_query($connection, $query) >> or die("Error in query: $query. " . >> pg_last_error($connection)); echo "Data successfully added."; >> // close database connection >> pg_close($connection); } ?> > > > Probably because "register globals" is off (default changed since > 4.2.0). http://ca3.php.net/register_globals > > Insert the following lines before "$query = ..." line: > > $name = $_POST[name]; > $address = $_POST[address]; > $tel = $_POST[tel]; > $email = $_POST[email]; > > > > ---------------------------(end of > broadcast)--------------------------- TIP 2: you can get off all > lists at once with the unregister command (send "unregister > YourEmailAddressHere" to majordomo@postgresql.org) you could you the following code : if ( phpversion() >= "4.2.0") { foreach($_POST as $keys=>$values) { ${$keys}=$values; } } else { foreach($HTTP_POST_VARS as $keys=>$values) { ${$keys}=$values; } }