From: | Keary Suska <hierophant(at)pcisys(dot)net> |
---|---|
To: | Postgres-PHP <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: Designing a Web Interface |
Date: | 2002-06-09 16:44:05 |
Message-ID: | B928E1F5.F542%hierophant@pcisys.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
on 6/9/02 9:08 AM, mmcgillick(at)attbi(dot)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"
From | Date | Subject | |
---|---|---|---|
Next Message | hodges | 2002-06-09 18:06:40 | Re: Designing a Web Interface |
Previous Message | mike | 2002-06-09 15:38:56 | Re: Designing a Web Interface |