Forum Moderators: coopster

Message Too Old, No Replies

Passing a variable.

syntax problems.

         

mack

4:32 am on Nov 5, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I have a dynamic page that is generated using a variable.

I then want to allow the user to click a link and have the variable pass on to a new script.

so if page1.php is the first page and is generated using the query $query

How would I pass the variable in a link?

page2.php?q=$query
page2.php?q=<$query>
page2.php?q=<%$query%>

I have been trying to find the right combination but I'am lost :(

Mack.

yintercept

5:47 am on Nov 5, 2003 (gmt 0)

10+ Year Member



I assume you are in HTML and simply want to break out and print a variable. Then syntax would be:

page2.php?q=<%=$query%>

jatar_k

5:54 am on Nov 5, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



page2.php?q=<?=$query?>

<?=?> is shorthand for echoing the variable contents

so it is in the url for page1? If so you may need to do it this way

page2.php?q=<?=$_GET['query']?>