CaTaLinU Posted March 7, 2012 Share Posted March 7, 2012 it is posible to make something like this? <a href="" onclick="refresh('index.php?info=1');"/>Index 1</a> <a href="" onclick="refresh('index.php?info=2');"/>Index 1</a> <a href="" onclick="refresh('index.php?info=3');"/>Index 3</a> and what code do i need to autorealod the index.php?info=(1,2,3) in my Index.php (simple php file with index.php?info=(1,2,3) include) ? Quote Link to comment https://forums.phpfreaks.com/topic/258462-onclick-code-help/ Share on other sites More sharing options...
dragon_sa Posted March 7, 2012 Share Posted March 7, 2012 This what do what you want <?php $info=$_GET['info']; // do some processing here ?> <a href="index.php?info=1" />Index 1</a> <a href="index.php?info=2" />Index 1</a> <a href="index.php?info=3" />Index 3</a> The variable $info would be available each time the link is clicked and would be the relnumbe 1, 2, or 3 Quote Link to comment https://forums.phpfreaks.com/topic/258462-onclick-code-help/#findComment-1324842 Share on other sites More sharing options...
CaTaLinU Posted March 7, 2012 Author Share Posted March 7, 2012 i have continut.php?info=(1,2,3) <?php $info = $_GET['info']; if($info == "1") { ?> Text 1 <? } if($info == "2") { ?> Text 2 <? } ?> and in index.php i want to add an include or something onmouseover or onclick that in don't wnat to refresh the whole page, i want to be refreshed just continut.php?info to the value 1,2 or 3 what i have choosed on onmouseover... Quote Link to comment https://forums.phpfreaks.com/topic/258462-onclick-code-help/#findComment-1324843 Share on other sites More sharing options...
KevinM1 Posted March 7, 2012 Share Posted March 7, 2012 If you don't want to refresh the entire page, you'll need to use AJAX. Quote Link to comment https://forums.phpfreaks.com/topic/258462-onclick-code-help/#findComment-1324846 Share on other sites More sharing options...
dragon_sa Posted March 7, 2012 Share Posted March 7, 2012 You will need to use either AJAX or put the continut.php page in an iframe and target the iframe with your link Quote Link to comment https://forums.phpfreaks.com/topic/258462-onclick-code-help/#findComment-1324847 Share on other sites More sharing options...
smerny Posted March 7, 2012 Share Posted March 7, 2012 or if it's a small amount of content you can just use javascript to hide/show already loaded content. Quote Link to comment https://forums.phpfreaks.com/topic/258462-onclick-code-help/#findComment-1324852 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.