passing php variables into href - need syntax help
Posted: Sun Nov 06, 2011 10:09 am
Hi,
I have been trying to pass a php variable into `a href`. I am by no means a pro, have looked up as many sites as possible to get the right syntax but just cant seem to get it right. Hope someone can help me. Here is the sample code I am trying to fix.
<input name="paymentform" class="butstyle" type="button" value="Click" onclick="location.href='pay2.htm?orderid='<?php echo $_SESSION['randno'] ?>'"/>
Seems fairly straight forward but just cant seem to get it right. $_SESSION['randno'] needs to be passed into this url so that the next page, pay2.html can pick it up.
Help please?
I have been trying to pass a php variable into `a href`. I am by no means a pro, have looked up as many sites as possible to get the right syntax but just cant seem to get it right. Hope someone can help me. Here is the sample code I am trying to fix.
<input name="paymentform" class="butstyle" type="button" value="Click" onclick="location.href='pay2.htm?orderid='<?php echo $_SESSION['randno'] ?>'"/>
Seems fairly straight forward but just cant seem to get it right. $_SESSION['randno'] needs to be passed into this url so that the next page, pay2.html can pick it up.
Help please?