PGTibs Posted February 15, 2009 Share Posted February 15, 2009 Sorry for this simple question but i can't find the answer... I have a webpage and on a link click i want the content to change so i set it up with $action = $_GET["action"]; if ($action == "1") { echo "portfolio"; } however, $_GET is for forms, this is just meant to be $action = when link pressed Whats the command for this? Quote Link to comment https://forums.phpfreaks.com/topic/145309-solved-simple-question/ Share on other sites More sharing options...
Mchl Posted February 15, 2009 Share Posted February 15, 2009 $_GET is for variables passed in URL (so not only forms) <a href="index.php?action=1">Perform action 1</a> Quote Link to comment https://forums.phpfreaks.com/topic/145309-solved-simple-question/#findComment-762828 Share on other sites More sharing options...
PGTibs Posted February 15, 2009 Author Share Posted February 15, 2009 Thats how it is at the moment, but it doesn't work? The page url just changes too index.php?action=1 but the if ($action == "1") stuff doesn't appear. Quote Link to comment https://forums.phpfreaks.com/topic/145309-solved-simple-question/#findComment-762830 Share on other sites More sharing options...
allworknoplay Posted February 15, 2009 Share Posted February 15, 2009 Try not putting double quotes around your "1". $action = $_GET["action"]; if ($action == 1) { echo "portfolio"; } Quote Link to comment https://forums.phpfreaks.com/topic/145309-solved-simple-question/#findComment-762832 Share on other sites More sharing options...
PGTibs Posted February 15, 2009 Author Share Posted February 15, 2009 Awesome, thanks. Told ya it was simple Quote Link to comment https://forums.phpfreaks.com/topic/145309-solved-simple-question/#findComment-762836 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.