Re: Passing Variables
| From: | Erik Price | Date: | Thu, 10 Jan 2002 22:19:06 +0000 |
| Subject: | Re: Passing Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80096@lists.php.net to get a copy of this message | ||
One way to pass a variable by clicking on a hyperlink is to make the HREF attribute of the anchor tag into a querystring with the variable that you want to pass.
If you want to pass the variable "$user_id" to the next page, with a value of "289", here is how you could do it:
<a href="./nextpage.php?user_id=289">Click here for the next page</a>
But keep in mind that this will pass the variable along in the browser's URL bar. Also realize that you may need to use the variable $_GET['user_id'] (instead of just $user_id) if your php.ini file has "register_globals" set to OFF.
Any variables passed along in a querystring like this are available as elements of the $_GET array, from what I understand, as an easy way to send a variable (as opposed to the more lengthy "hidden form field" method).
Erik
On Thursday, January 10, 2002, at 05:07 PM, Artie Ball wrote:
Hi all, Could anyone please tell me if there is a way pass a value to a variable by clicking on a hyperlink, or run a function on a page by clicking on a hyperlink. Thanks Artie Ball MCP Associate Network Administrator Atlanta History Center 130 West Paces Ferry Road, NW Atlanta, GA, 30305 Office: 404-814-2047 Fax: 404-814-4186 Cell: 678-362-3531 Visit our website - www.AtlantaHistoryCenter.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net