pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris <chris@interspire.com>
To: 'Yasmine Kedoo' <yazkedoo@hotmail.com>
To: pgsql-php@postgresql.org
Subject: Re: Parsing Data, Table to Form
Date: Mon, 10 May 2004 09:39:21 +1000
Message-ID: <002801c4361e$dada39b0$0d00a8c0@chris> (raw)
In-Reply-To: <BAY14-F29Xuz8xUrQ610001e83b@hotmail.com>

Hi Yasmine,

If you click the link only, it will not submit the form and pass the
information on. You need to have a 'submit' button in your form and hit
that.

Chris.


-----Original Message-----
From: pgsql-php-owner@postgresql.org
[mailto:pgsql-php-owner@postgresql.org] On Behalf Of Yasmine Kedoo
Sent: Monday, May 10, 2004 9:18 AM
To: pgsql-php@postgresql.org
Subject: Re: [PHP] Parsing Data, Table to Form


Hi again.

I have carried out a search, then displayed the results in a table on a
php 
page called admininfo.php:

$row = pg_fetch_object($result, 0);

$test = "";

	   for ($rw = 0; $rw < $maxrows; $rw++)
	   {
		echo " <tr> ";

		for ($fld = 0; $fld < $maxfields ; $fld++)
		{

    	                echo "<td width=\"418\" class=\"tabletext\" 
height=\"38\">";
		echo pg_Result($result,$rw,$fld);
		$test .= pg_Result($result,$rw,$fld);
		echo "</td>";

		echo "<form method=post action=updaad.php>\n";

		}
		echo "<td width=\"194\" class=\"tabletext\"
height=\"38\"> </td> </tr>";

	   }

Now, i would like to parse the information displayed in the table to 
textfields on the page updaad.php, i've used a link to do this:

<a href="updaad.php">Update</a>

On the page updaad.php, i have displyed the textfields using the
following 
code:

echo "Admin ID Number: <input type=text name=\"formadid\"
value=\"$fld\"><br 
/>\n";
echo "Name: <input type=text name=\"formname\" value=\"$fld\"><br />\n";
echo "Surname: <input type=text name=\"formsurname\" value=\"$fld\"><br 
/>\n";
echo "Phone: <input type=text name=\"formphone\" value=\"$fld\"><br
/>\n"; echo "Email: <input type=text name=\"formemail\"
value=\"$fld\"><br />\n"; echo "Username: <input type=text
name=\"formusername\" value=\"$fld\"><br 
/>\n";
echo "Password: <input type=text name=\"formpassword\"
value=\"$fld\"><br 
/>\n";
echo "Building: <input type=text name=\"formbuilding\"
value=\"$fld\"><br 
/>\n";
echo "Postcode: <input type=text name=\"formpsotcode\"
value=\"$fld\"><br 
/>\n<br>";
echo "<input type=submit value=Update></form>\n";

but i am unable to write the information displayed in the table in 
admininfo.php, to the textfields in updaad.php.

Has anybody got any suggestions? :-)

Thanx

Yaz




>From: brew@theMode.com
>To: Yasmine Kedoo <yazkedoo@hotmail.com>
>Subject: Re: [PHP] Parsing Data, Table to Form
>Date: Sun, 9 May 2004 11:36:14 -0400 (EDT)
>
>
>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@theMode.com)
>      Check out my Musician's Online Database Exchange (The MODE Pages)
>                         http://www.TheMode.com
>  
>=======================================================================
>===
>

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org




view thread (10+ messages)  latest in thread

Message-ID: <002801c4361e$dada39b0$0d00a8c0@chris>
Permalink:  ../002801c4361e$dada39b0$0d00a8c0@chris/
Also on:    postgresql.org/message-id/002801c4361e$dada39b0$0d00a8c0@chris

 · 

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: chris@interspire.com, yazkedoo@hotmail.com
  Subject: Re: Parsing Data, Table to Form
  In-Reply-To: <002801c4361e$dada39b0$0d00a8c0@chris>
  References: <BAY14-F29Xuz8xUrQ610001e83b@hotmail.com> <002801c4361e$dada39b0$0d00a8c0@chris>

* 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