From: | "philip johnson" <philip(dot)johnson(at)atempo(dot)com> |
---|---|
To: | <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: PHP form Creates Blank DB entries |
Date: | 2003-07-01 08:06:37 |
Message-ID: | NDBBJLHHAKJFNNCGFBHLAEHIFLAA.philip.johnson@atempo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
pgsql-php-owner(at)postgresql(dot)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(at)postgresql(dot)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;
}
}
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Hanna | 2003-07-01 09:59:13 | Re: Best way to convert PG's TIMESTAMPTZ to PHP DATE? |
Previous Message | Christopher Kings-Lynne | 2003-07-01 02:02:23 | Re: Best way to convert PG's TIMESTAMPTZ to PHP DATE? |