redgunner Posted August 30, 2010 Share Posted August 30, 2010 How can I change a variable with an onclick href... Thanks in advance... Quote Link to comment Share on other sites More sharing options...
TGWSE_GY Posted August 30, 2010 Share Posted August 30, 2010 <a href="index.php?section=home&myvariable=newvalue">CLICK ME</a> Quote Link to comment Share on other sites More sharing options...
redgunner Posted August 30, 2010 Author Share Posted August 30, 2010 Im looking for something that can do this <a onclick="<?php $id = '1'; ?>">Change variable to 1</a> Quote Link to comment Share on other sites More sharing options...
TGWSE_GY Posted August 30, 2010 Share Posted August 30, 2010 Are you wanting to change the value of a variable before something is submitted? I am not really understanding what you are asking. Not being dense but need to know what you are trying to apply this to better help you. Thanks TGWSE_GY Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 30, 2010 Share Posted August 30, 2010 JavaScript acts client-side, and PHP is server-side. You can't update a PHP variable without reloading the page, unless you use an AJAX request to update a variable. What exactly are you trying to achieve by updating a PHP variable? Quote Link to comment Share on other sites More sharing options...
redgunner Posted August 30, 2010 Author Share Posted August 30, 2010 I am using jquery tabs to tab1 is #tab1 tab2 is #tab2 as you see its <a href="#tab2"></a> so I need to pass a variable when its clicked for example $id = '1'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.