passing vars from page to page

  • Thread starter Thread starter Anonymous
  • Start date Start date
A

Anonymous

Guest
Something like this should work:

<a href="http://www.someserver/somepage/<?php print(!empty($_REQUEST['level']) ? '?level='.$_REQUEST['level'] : ''); ?>">link name</a>

you can retrieve the level passed from another page by using one of the following:
$_REQUEST['level']
$_POST['level']
$_GET['level']

You can then add this variable to your link by printing it where it needs to go. The above example tests to make sure the level is not empty, if it is, it will append an empty string to the url. If it is not empty, it will add a '?' and the level variable to the url.

The syntax of:
(test) ? (something) : (something else)
is just short hand for the if-then-else.
 
Back
Top