From: philip johnson <philip.johnson@atempo.com>
To: pgsql-php@postgresql.org
Subject: Re: PHP form Creates Blank DB entries
Date: Tue, 1 Jul 2003 10:06:37 +0200
Message-ID: <NDBBJLHHAKJFNNCGFBHLAEHIFLAA.philip.johnson@atempo.com> (raw)
In-Reply-To: <5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca>
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;
}
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: philip.johnson@atempo.com
Subject: Re: PHP form Creates Blank DB entries
In-Reply-To: <NDBBJLHHAKJFNNCGFBHLAEHIFLAA.philip.johnson@atempo.com>
References: <5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca> <NDBBJLHHAKJFNNCGFBHLAEHIFLAA.philip.johnson@atempo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox