redgunner Posted August 30, 2010 Share Posted August 30, 2010 How can I change a variable with an onclick href... Thanks in advance... Link to comment https://forums.phpfreaks.com/topic/212059-href-onclick-variable/ 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> Link to comment https://forums.phpfreaks.com/topic/212059-href-onclick-variable/#findComment-1105122 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> Link to comment https://forums.phpfreaks.com/topic/212059-href-onclick-variable/#findComment-1105125 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 Link to comment https://forums.phpfreaks.com/topic/212059-href-onclick-variable/#findComment-1105135 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? Link to comment https://forums.phpfreaks.com/topic/212059-href-onclick-variable/#findComment-1105179 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'; Link to comment https://forums.phpfreaks.com/topic/212059-href-onclick-variable/#findComment-1105182 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.