Forum Moderators: coopster

Message Too Old, No Replies

Passing a variable with a link

         

dougmcc1

11:12 pm on Nov 1, 2003 (gmt 0)

10+ Year Member



How do you pass a variable to a PHP script with a link?

For example, I want to use something like the following to pass the variable $var to a PHP script:

<a name="var" value="test" href="scripts/script.php">test</a>

Thanks.

jatar_k

12:19 am on Nov 2, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



<a href="scripts/script.php?var=test">test</a>

then acces it via the $_GET array

dreamcatcher

8:30 am on Nov 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Attaching it to the URL is the simplest way. You can also pass information as a hidden variable.

<input type="hidden" name="var" value="$test">