richiec Posted November 4, 2007 Share Posted November 4, 2007 alot of php sites in there url have something like www.whatever.com/site.php?page=hello ive always wonderd how to do that, im sure its pretty simple.. im asking because i just wana keep the main page the same name and have different site.php?= so like www.whatever.com/site.php?page=hello and then www.whatever.com/site.php?page=goodbye Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 4, 2007 Share Posted November 4, 2007 You just simply add it to your link <a href="test.php?page=hello"> Or you can put it in your form action. Read this to help you (read about the GET method) http://www.tizag.com/phpT/postget.php Quote Link to comment Share on other sites More sharing options...
richiec Posted November 4, 2007 Author Share Posted November 4, 2007 still dont get it though, all i want it to do is show a different page just putting the ?page= in the link doesnt change it to the page which the page= if you see what i mean it just shows the original page Quote Link to comment Share on other sites More sharing options...
Demonic Posted November 4, 2007 Share Posted November 4, 2007 <?php $page = $_GET['page']; switch($page) { case "anotherpage": echo "THis is another page"; break; default: echo "This is the default page."; break; } ?> access that by w/e.php?page=anotherpage Quote Link to comment Share on other sites More sharing options...
richiec Posted November 4, 2007 Author Share Posted November 4, 2007 thanks, that works. 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.