execute change variable only on click
Posted: Sat Aug 13, 2005 3:38 pm
I thought this would be pretty straightforward, but it's not working...
I want to change the value of a session variable ONLY if the link is clicked on, however php seems to be executing every <? , so my variable is always the value of the last one on the page (eg. in the code below it is always "test2".
<A HREF="../cgi-bin/teddytest/index.cgi" class="class1" TARGET="_parent" <? $_SESSION['teddy']="test1";?> ><SPAN CLASS="body">teddy test1</SPAN></A>
<A HREF="../cgi-bin/teddytest2/index.cgi" class="class1" TARGET="_parent" <? $_SESSION['teddy']="test2";?> ><SPAN CLASS="body">teddy test2</SPAN></A>
i would pass the variable via the url but this is a little add on to site uses iframes and it was not working that way.
I want to change the value of a session variable ONLY if the link is clicked on, however php seems to be executing every <? , so my variable is always the value of the last one on the page (eg. in the code below it is always "test2".
<A HREF="../cgi-bin/teddytest/index.cgi" class="class1" TARGET="_parent" <? $_SESSION['teddy']="test1";?> ><SPAN CLASS="body">teddy test1</SPAN></A>
<A HREF="../cgi-bin/teddytest2/index.cgi" class="class1" TARGET="_parent" <? $_SESSION['teddy']="test2";?> ><SPAN CLASS="body">teddy test2</SPAN></A>
i would pass the variable via the url but this is a little add on to site uses iframes and it was not working that way.