HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Interactive Table
Post new topic   Reply to topic    HTML Help Forum Index -> PHP
View previous topic :: View next topic  
Author Message
LAN_Rover



Joined: 06 Feb 2006
Posts: 19
Location: Petawawa, Ontario, CANADA

PostPosted: Sun Apr 15, 2007 12:11 pm     Interactive Table Reply with quote

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

PostPosted: Sun Apr 15, 2007 1:02 pm     Reply with quote



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

PostPosted: Sun Apr 15, 2007 3:12 pm     Reply with quote

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

PostPosted: Sun Apr 22, 2007 4:36 pm     Reply with quote

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

PostPosted: Sun Apr 22, 2007 4:49 pm     Reply with quote

That should do it Very Happy
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> PHP All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial