Forum Moderators: coopster

Message Too Old, No Replies

Selecting ID for current ID for editing

         

sandratampa

11:31 pm on Feb 27, 2008 (gmt 0)

10+ Year Member



I have a contacts database. I have a page displaying the record for ID #423. The url is http://www.example.com/database/show_contact.php?id=423

While viewing this record, I want to "click to edit record" and have the script select the current ID and direct to my edit page (show_modcontact.php)

Can you provide me the scirpt? Thanks much, I'm new at this :)

[edited by: eelixduppy at 11:46 pm (utc) on Feb. 27, 2008]
[edit reason] exemplified [/edit]

whoisgregg

3:12 pm on Feb 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, sandratampa! Tampa... Florida? :)

Does the show_modcontact.php expect the ID to be passed in the URL (GET) or through a form (POST)?

If URL (GET), add code like this to your show_contact.php script:

echo '<p><a href="/database/show_modcontact.php?id='.intval($_GET['id']).'">click to edit</a></p>';

If a form (POST), add code like this to your show_contact.php script:

echo '<form action="/database/show_modcontact.php" method="post">
<input type="hidden" name="id" value="'.intval($_GET['id']).'" />
<input type="submit" value="click to edit" />
</form>';

sandratampa

5:23 pm on Mar 11, 2008 (gmt 0)

10+ Year Member



Sorry for the delay...I have not been able to get back to this project. But, the POST script works. Thanks sooo much!

Yes, Sunny Tampa, Florida. :)

whoisgregg

8:11 pm on Mar 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad you got it sorted out.

Your post jumped out at me because I'm also in Tampa. Welcome again, happy to have a fellow Tampanian. :)