jimfog Posted February 15, 2012 Share Posted February 15, 2012 Suppose we have the following code: <li><a href=" ' . $_SERVER["PHP_SELF"] . "?nest=" . $test . ' ">click here</a></li> If i wanted to access nest i would write: if (isset($_GET['nest'])) { The question is, what is the syntax to access $test?Because we might have the following code: <a href=" ' . $_SERVER["PHP_SELF"] . "?nest=" . $test . ' ">Click here</a><a href=" ' . $_SERVER["PHP_SELF"] . "?nest=" . $test1 . ' ">Click here1</a> and i want to grab only $test1-with if (isset($_GET['nest'])) i access both of them sth i do not want. Link to comment Share on other sites More sharing options...
justsomeguy Posted February 15, 2012 Share Posted February 15, 2012 Give them different names instead of calling them both nest if you need to distinguish between them. Link to comment Share on other sites More sharing options...
jimfog Posted February 15, 2012 Author Share Posted February 15, 2012 Give them different names instead of calling them both nest if you need to distinguish between them.Ok besides that, is there a way accessing them, without changing the name of "nest"? I am asking out of curiosity. Link to comment Share on other sites More sharing options...
boen_robot Posted February 15, 2012 Share Posted February 15, 2012 You can split the string... like echo '<a href="' . $_SERVER["PHP_SELF"] . "?nest=" . $test . '">Click here</a>';if (isset($_GET['nest'])) {echo '<a href="' . $_SERVER["PHP_SELF"] . "?nest=" . $test1 . '">Click here1</a>';} Link to comment Share on other sites More sharing options...
dsonesuk Posted February 15, 2012 Share Posted February 15, 2012 and i want to grab only $test1-with if (isset($_GET['nest'])) i access both of them sth i do not want. ??? if (isset($_GET['nest'])) will only retrieve one nest value of the link that was clicked, definitely not both of them, on the loading of page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.