Re: Designing a Web Interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



on 6/9/02 9:08 AM, mmcgillick@xxxxxxxxx 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"



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux