pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@sympatico.ca>
To: pgsql-php@postgresql.org
Subject: Re: PHP form Creates Blank DB entries
Date: Mon, 30 Jun 2003 13:23:17 -0400
Message-ID: <5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca> (raw)
In-Reply-To: <3EC8256A-AB16-11D7-8634-00039308EB2C@hwcn.org>

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];





view thread (6+ messages)  latest in thread

Message-ID: <5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca>
Permalink:  ../5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca/
Also on:    postgresql.org/message-id/5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca

 · 

reply

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: fbax@sympatico.ca
  Subject: Re: PHP form Creates Blank DB entries
  In-Reply-To: <5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca>
  References: <3EC8256A-AB16-11D7-8634-00039308EB2C@hwcn.org> <5.2.1.1.0.20030630131653.00aa7df0@pop6.sympatico.ca>

* 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