From: Keary Suska <hierophant@pcisys.net>
To: Postgres-PHP <pgsql-php@postgresql.org>
Subject: Re: Designing a Web Interface
Date: Sun, 09 Jun 2002 10:44:05 -0600
Message-ID: <B928E1F5.F542%hierophant@pcisys.net> (raw)
In-Reply-To: <000001c20fc7$79e69ba0$0200a8c0@venus>
on 6/9/02 9:08 AM, mmcgillick@attbi.com purportedly said:
> I¹ve set up a PostgreSQL database on my Red Hat Linux 7.3 box. I¹m trying to
> figure out how to put together a web page to administer records in the
> database. I¹d like my web site to behave in the manner of a software
> application where the page itself is updated when I submit changes, and I
> don¹t have to go to a new page to see the change, and then click to get back
> to the main page.
If I understand you correctly, which I am not certain since your description
is ambiguous, you want a page that displays database row fields in an
editable form, and you want to submit the form which returns to the form
with the new updated values, yes? If so, frames are unnecessary. You would
only want some kind of frame implementation if you want some part of the
display to *not* change when a form is submitted or a link clicked in some
context.
I often use the logic:
if( $_SERVER['REQUEST_METHOD'] == 'GET' ) {
// get database info, store in associative array: I will use $data
// you may need to distinguish between editing and adding
}
elseif( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
// untaint data, store in $data; update/insert as the case may be
}
// here, display the form with default values according to $data
__END__
If you want to account for multi-user access, where a different user may
have also changed the data after you have but before the page is displayed,
you can redirect to the same page:
header( "Location: /page/URL" );
This will force the script to re-read from the database, instead of just
using the submitted data. If performance is an issue, this step may be
avoided since the situation would not occur too frequently.
Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"
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: hierophant@pcisys.net
Subject: Re: Designing a Web Interface
In-Reply-To: <B928E1F5.F542%hierophant@pcisys.net>
References: <000001c20fc7$79e69ba0$0200a8c0@venus> <B928E1F5.F542%hierophant@pcisys.net>
* 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