Re: Parsing Data, Table to Form

From: brew(at)theMode(dot)com
To: pgsql-php(at)postgresql(dot)org
Subject: Re: Parsing Data, Table to Form
Date: 2004-05-09 15:38:35
Message-ID: Pine.BSF.4.58.0405091137350.39457@themode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php


Yaz......

> i want to be able to display the table information in editable form
> fields, so that the data may be altered and the database updated.

If by table information, you mean the information contained in the table,
then what I do is get one row's data and load it into variables. I use
the variables as the default text in the form (check the html standard).
After the user makes any edits he updates the entire row.

This only works with text boxes, with radio buttons and on/off buttons you
have to generate different html depending on the existing button state.

It's not complicated, just tedious to code if it has lots of buttons. If
it's only text it's easier. I think I started with an example someone
posted on php.net, maybe you can search for that and use it for reference,
too. I think it has a subroutine to generate the buttons preselected by
the existing state of the database.

My script is long, involving switches to display the possible rows to be
edited for a user on the first pass, then displaying the info for the row
selected in an editable form, then updating (or inserting the row if it
doesn't exist) and going back to displaying all the possible rows for that
user. I have to study it for a while myself, remembering how it works
before I make any changes to it! Hopefully somebody else has a more basic
example.

If by table information you mean the definition of a table in the
database, then that would be diferent, although still involving somewhat
the same type of script, just working on different database information.
All my table definitions are static in my database, so I've never done it
from a script, though.

brew

==========================================================================
Strange Brew (brew(at)theMode(dot)com)
Check out my Musician's Online Database Exchange (The MODE Pages)
http://www.TheMode.com
==========================================================================

Browse pgsql-php by date

  From Date Subject
Next Message Yasmine Kedoo 2004-05-09 23:18:24 Re: Parsing Data, Table to Form
Previous Message Gavin M. Roy 2004-05-09 15:24:49 Re: Parsing Data, Table to Form