CrazeD Posted February 22, 2007 Share Posted February 22, 2007 How do I make a page with the ".php?page=1" or something like that? Or, what is this called, so I can research it? Thanks. Link to comment https://forums.phpfreaks.com/topic/39587-how-to-make-a-page-such-as-pagephp1-etc/ Share on other sites More sharing options...
shank888 Posted February 22, 2007 Share Posted February 22, 2007 $action = $_GET['action']; if (ACTION) { page to be displayed here } to view page: http://url.com/file.php?action=ACTION I hope this is what you mean Link to comment https://forums.phpfreaks.com/topic/39587-how-to-make-a-page-such-as-pagephp1-etc/#findComment-191006 Share on other sites More sharing options...
CrazeD Posted February 22, 2007 Author Share Posted February 22, 2007 Yes that's what I mean, but could you explain in more detail how to use it, or provide some source to read about it? I'm still lost... Thanks. Link to comment https://forums.phpfreaks.com/topic/39587-how-to-make-a-page-such-as-pagephp1-etc/#findComment-191129 Share on other sites More sharing options...
heckenschutze Posted February 22, 2007 Share Posted February 22, 2007 Its called a query string. PHP parsers everything after the filename in the format ?key=value into the $_GET superglobal array)... You can test this like: <?php echo "<pre>"; print_r($_GET); echo "</pre>"; ?> Basically this allows you to pass small amounts of information from page to page, (information that you don't mind the user from easily editing)... You can read about it briefly at: http://php.net/manual/en/reserved.variables.php#reserved.variables.get hth! Link to comment https://forums.phpfreaks.com/topic/39587-how-to-make-a-page-such-as-pagephp1-etc/#findComment-191130 Share on other sites More sharing options...
redarrow Posted February 22, 2007 Share Posted February 22, 2007 test.php <?php echo"<a href='test_result.php?php=nice'>goto my page</a>"; ?> test_result.php <?php if($_GET['php']=="nice"){ echo"hello i am redarrow hows you mate"; }else{ echo "Why are you trying to hack me!"; } ?> Link to comment https://forums.phpfreaks.com/topic/39587-how-to-make-a-page-such-as-pagephp1-etc/#findComment-191133 Share on other sites More sharing options...
heckenschutze Posted February 22, 2007 Share Posted February 22, 2007 Ahh, redarrow your example crack me up everytime Link to comment https://forums.phpfreaks.com/topic/39587-how-to-make-a-page-such-as-pagephp1-etc/#findComment-191134 Share on other sites More sharing options...
CrazeD Posted February 22, 2007 Author Share Posted February 22, 2007 Its called a query string. PHP parsers everything after the filename in the format ?key=value into the $_GET superglobal array)... You can test this like: <?php echo "<pre>"; print_r($_GET); echo "</pre>"; ?> Basically this allows you to pass small amounts of information from page to page, (information that you don't mind the user from easily editing)... You can read about it briefly at: http://php.net/manual/en/reserved.variables.php#reserved.variables.get hth! Thanks, but I know what the $_GET does...I just don't know how to make different pages with it. redarrow: This is kind of what I want, but I wanted it in one page and to show something different. I put it in one page, with this: <?php echo"<a href='test_result.php?php=nice'>goto my page</a>"; if($_GET['php']=="nice"){ echo"hello i am redarrow hows you mate"; } ?> But, it shows "goto my pagehello i am redarrow hows you mate" when I click the link. Can I make a whole new page, IE: so it just says "hello i am redarrow hows you mate"? Thanks. Link to comment https://forums.phpfreaks.com/topic/39587-how-to-make-a-page-such-as-pagephp1-etc/#findComment-191144 Share on other sites More sharing options...
heckenschutze Posted February 22, 2007 Share Posted February 22, 2007 eg... <?php switch($_GET['page']) { case "page1": echo "page1"; break; case "page2": echo "page2"; break; case "default": echo "my default page"; break; } ?> Link to comment https://forums.phpfreaks.com/topic/39587-how-to-make-a-page-such-as-pagephp1-etc/#findComment-191166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.