Wednesday 15 February 2012

html - How to pass a PHP variable to a link in the same page -



html - How to pass a PHP variable to a link in the same page -

i newbie in programming , might basic. (i searched in net can't find solution).

my case: in html file, retrieving url parameter $_get['s1'] , code:

<?php $username=$_get['s1']; ?>

i successful in doing thing need $username variable within link in same page.

this link button in same page. 1 time clicked, take page. , code follow:

<a href="http://www.mywebsite.com/am/index.php/myusername_1 " id="btn_1_eed2a4ea6f9ab0ffcae6eced4295bd8e" class="css-button style-1"><span class="text">book</span><span class="hover"></span><span class="active"></span></a>

i want replace myusername in http://www.mywebsite.com/am/index.php/myusername_1 $username.

i might not able alter the button code using programme called "optimizepress" build page. can insert link of button , insert custom html or shortcode anywhere in page.

this page given affiliates , don't want insert every affiliate's unique link in duplicate of page. want affiliates' links generated automatically.

thanks in advance

you can utilize next -

<?php $username = htmlspecialchars($_get['s1']); ?>

and html code -

<a href="http://www.mywebsite.com/am/index.php/<?php echo $username; ?> " id="btn_1_eed2a4ea6f9ab0ffcae6eced4295bd8e" class="css-button style-1"><span class="text">book</span><span class="hover"></span><span class="active"></span></a>

php html

No comments:

Post a Comment