crazyben21 Posted September 24, 2009 Share Posted September 24, 2009 Hi I'm reading this online article at http://blog.themeforest.net/tutorials/simple-layouts-with-php/. But I'm a bit confused in understanding "Technique #2". The part I'm confused at is were $_GET['page'] is getting the value from. When I do forms i do know were it is getting the value from. But in this website tutorial I'm confused were do it gets its value from. Can somebody show me how to this technique but in a better way or help me understand it. Thank You Ben Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 24, 2009 Share Posted September 24, 2009 Say you have something.php?page=this then $_GET['page'] would be "this"; Quote Link to comment Share on other sites More sharing options...
Maq Posted September 24, 2009 Share Posted September 24, 2009 In technique #2 they mention: Say this is the URL to our about page: http://domain.com/index.php?page=about Which means that your links should follow a similar format: About Contact Pictures Now when a user clicks on "About" you are passing the "page=about" parameter via the URL. The protocol to retrieve this value is by using: $_GET['page'] If you echo this out it will print out exactly "about". The technique they're using forces you to create files of the exact values for each link (GET parameter). As a result you can dynamically include your pages. Hence: In which you would include, assuming you click on the "About" link, about.php page. To illustrate this point you can echo something similar to: echo $_GET['page'] . " .php"; NOTE: Be careful with this method as users can inject arbitrary values into the URL parameter. Hope this helps. Quote Link to comment Share on other sites More sharing options...
crazyben21 Posted September 24, 2009 Author Share Posted September 24, 2009 Ahh. Thank You Maq. This make everything clearer now. 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.