Help Passing A Variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dgny06
Forum Commoner
Posts: 25
Joined: Thu Jun 14, 2007 11:35 pm

Help Passing A Variable

Post by dgny06 »

OK...I know this is a very remedial question but I am stumped.

I have created an admin page that will edit a participant's information in a form. The user is found via a query that looks him/her up according to their ParticipantID. I am trying to pass that ParticipantID into the admin page though the URL (which works) but the problem is I do not know how to declare the variable on the admin page since I am not using a form on the previous page. I therefore can not use the normal $_Get["xxxxxxx"] method.

I am passing the variable on the first page by:

Code: Select all

<td><a href='edit_participant.php?ParticipantID=$ParticipantID'>$ParticipantID</a></td>
Thanks in advance for your help!
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Then on the next page code something like this:

Code: Select all

<?php
$ParticipantID = isset($_GET['ParticipantID']) ? $_GET['ParticipantID'] : -1; // or some othe default value
?>
dgny06
Forum Commoner
Posts: 25
Joined: Thu Jun 14, 2007 11:35 pm

Post by dgny06 »

that worked.......thanks
Post Reply