[UPHPU] Form Help

Dave Smith DavidSmith at byu.net
Fri Jun 24 09:52:57 MDT 2005


> What I want to do is when someone clicks on the Edit button (green
> check mark) it takes them to a page that is prefilled with the
> information from the "member" that was selected.

I would just use the query string like so:

<a href="editmember.php?id=<?php echo $id; ?>"><img src="greencheck.gif"></a>

Then, in the editmember.php file, just grab the $id value out of the $_GET
array like so:

<?php
  $member_id_to_edit = $_GET['id'];
  // Do the database query here using the $member_id_to_edit
  // ...  SELECT * from Name where ID=$id
?>

Of course, if you don't have ID numbers, then you could use some other
form of identification.

I may also humbly recommend that you pick up a PHP/MySQL book to get some
good ideas for how this sort of thing is usually done.

Also, you'll need to worry about security since users could do anything to
that 'id' value in the query string (including write their own SQL code to
really mess with you). This is where it gets more important to go pick up
a good book.

Good luck!

--Dave



More information about the UPHPU mailing list