 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
LAN_Rover

Joined: 06 Feb 2006 Posts: 19 Location: Petawawa, Ontario, CANADA
|
Posted: Sun Apr 15, 2007 12:11 pm Interactive Table |
|
|
|
I'm putting a membership list on-line, which is viewed in a dynamic table built by php and mysql.
I want to be able to edit information by clicking on an item in the table.
Ideally the cell will change to an input text box. Or I can go to the page where I enter new user's information, and populate the form with the current data.
Any ideas on how to do this? I'm pretty vague on java and I don't know how to do it with HTML or php |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8268 Location: Castle Rock CO USA
|
Posted: Sun Apr 15, 2007 1:02 pm |
|
|
|
I don't know anything about PHP unfortunately, but it sounds like you are wanting a CMS of sorts? You might check out Content Seed to see if that helps. There are thousands of CMSs out there.
Or you might check out www.php.net for script examples until someone else comes along that can help you here
_________________
Corey
Toll Free Numbers | Merchant Accounts |
|
SteveH
Joined: 11 Apr 2007 Posts: 208
|
Posted: Sun Apr 15, 2007 3:12 pm |
|
|
|
Hiya, Lan.
In the code of your member list page there's a repeating region which loops through your db table and writes the HTML to the page.
You want to write in a link around the name of the member which includes the record id, something like this:
| Code: |
| <a href="edit_mmbr.php?id=<?= '$id' ?>"><?= $mmbr_name ?></a> |
Of course, you have to pull the record id with your mySQL query in the member listing page.
When you click on the member name, you will be forwarded to the edit_mmbr.php page with the specific member's record id in the URL (i.e. edit_mmbr.php?id=42).
The edit_mmbr.php page will include a form with all the fields you want to be able to change in the member record. Use $_GET['id'] to pull the record id from the URL. Plug that value into your mySQL query for the edit_member.php page:
| Code: |
| $query="SELECT * FROM members WHERE id='$id'"; |
Populate the form from the mySQL query results. Make sure the form fields are named exactly the same as the table columns.
The action= for the form points to your update_mmbr.php page, which will include code something like:
| Code: |
| $query="UPDATE members SET fname='$fname', lname='$lname' WHERE id='$id'"; |
Hope that helps. |
|
LAN_Rover

Joined: 06 Feb 2006 Posts: 19 Location: Petawawa, Ontario, CANADA
|
Posted: Sun Apr 22, 2007 4:36 pm |
|
|
|
Thanks Steve, that's sort-of what i've done.
I changed the row to have a double-click attribute that goes to the edit user page and provides the member_ID in the link.
kinda like this:
<tr ondblclick= \"window.location=( '/edit_mbr.php?action=Edit+Member&member_ID=".$row['member_ID']." ' )\">
I "think" that's ok to do... works in my localhost |
|
SteveH
Joined: 11 Apr 2007 Posts: 208
|
Posted: Sun Apr 22, 2007 4:49 pm |
|
|
|
That should do it  |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|