loveranger Posted February 27, 2009 Share Posted February 27, 2009 I have almost no knowledge in PHP but willing to learn now. Right now I want to know how to pages with the links like www.domain.com/test.php?=test (so it hides the initial page link) For example, you can see this done in http://www.desi-nation.info when you hover over the links of the channels. Any tutorial links or explanations here would be greatly appreciated. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/147165-very-new-to-php-need-help-with-creating-pages-like-namephptest/ Share on other sites More sharing options...
Stephen68 Posted February 27, 2009 Share Posted February 27, 2009 Not really sure what your asking? Could you explain it more? Quote Link to comment https://forums.phpfreaks.com/topic/147165-very-new-to-php-need-help-with-creating-pages-like-namephptest/#findComment-772556 Share on other sites More sharing options...
Mchl Posted February 27, 2009 Share Posted February 27, 2009 This is so called GET method of passing variables to a script. Try <?php echo $_GET["txt"]; ?> save it as test.php and then point your browser to test.php?txt=foobar Quote Link to comment https://forums.phpfreaks.com/topic/147165-very-new-to-php-need-help-with-creating-pages-like-namephptest/#findComment-772557 Share on other sites More sharing options...
RussellReal Posted February 27, 2009 Share Posted February 27, 2009 test.php?test=whatever does not "hide" any links all that does is send the value "whatever" to the file "test.php" and this value is accessed within test.php as $_GET['test'] the variable assigned in the url "test=whatever" Quote Link to comment https://forums.phpfreaks.com/topic/147165-very-new-to-php-need-help-with-creating-pages-like-namephptest/#findComment-772566 Share on other sites More sharing options...
daviddth Posted February 27, 2009 Share Posted February 27, 2009 I have almost no knowledge in PHP but willing to learn now. Right now I want to know how to pages with the links like www.domain.com/test.php?=test (so it hides the initial page link) I do this a bit in various pages, and the way I do it is basically this... Oh this is from a hidden, password protected database editing screen - the users only ever read the data on "static" pages, not write it, so I wanted a single page with, in this case, about 15 options including view, edit, delete and add to 2 different databases. Theres other ways to do it, but this works for me. Each option 1, 2 etc is basically a fully self-contained section other than a header & footer for the page. <?php //Common header items like checking database connectivity etc, laying out any default page layouts etc //as well as lots of comments so I know what I was thinking when I come back months later lol. $pid=$_GET['pid']; //This gets the pid variable from the called page. In my case I have about 15 value for it, and some //pages also have secondary bits such as pid=3 below if ($pid=='1') { // Code for Page ID = 1 } if ($pid=='2') { //Code for Page ID = 2 } if ($pid=='3') { $alphindex = $_GET['alphindex']; if ($alphindex==''){ // code for alphindex being blank } else { //code for a non blank alphindex } // Common footer section goes here before the end of the page Quote Link to comment https://forums.phpfreaks.com/topic/147165-very-new-to-php-need-help-with-creating-pages-like-namephptest/#findComment-772656 Share on other sites More sharing options...
loveranger Posted February 28, 2009 Author Share Posted February 28, 2009 This is so called GET method of passing variables to a script. Try <?php echo $_GET["txt"]; ?> save it as test.php and then point your browser to test.php?txt=foobar A little confused.. where does the term "foobar" come from the code? Is there a tutorial link you can provide where I can start this from scratch.. it would be much appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/147165-very-new-to-php-need-help-with-creating-pages-like-namephptest/#findComment-773267 Share on other sites More sharing options...
tefuzz Posted February 28, 2009 Share Posted February 28, 2009 I had a topic just like this, and there were a few replies, this was the best system i found to do it for on my site...depending how large your site is, or how in depth it gets you may need more than this. just copy this code to a blank page and try it out. save the page as pagetest.php and upload it. <?php $p = $_GET['p']; //get the correct page id (p) from the URL switch ($p) { //begin switch, choose the right resulting page data default: //this is the default, so whenever the page is loaded without an id, it displays this echo '<a href="pagetest.php?p=hello"> HELLO</a><BR /><BR />'; echo '<a href="pagetest.php?p=goodbye"> GOODBYE</a><BR /><BR />'; break; case "hello" : //if the id is hello echo 'Hello, and welcome to our page!'; break; case "goodbye" : //if the ?p= is goodbye echo 'Thanks for coming, Goodbye!'; break; } //end switch ?> Quote Link to comment https://forums.phpfreaks.com/topic/147165-very-new-to-php-need-help-with-creating-pages-like-namephptest/#findComment-773274 Share on other sites More sharing options...
corbin Posted February 28, 2009 Share Posted February 28, 2009 http://www.tizag.com/phpT/postget.php http://www.w3schools.com/PHP/php_get.asp Quote Link to comment https://forums.phpfreaks.com/topic/147165-very-new-to-php-need-help-with-creating-pages-like-namephptest/#findComment-773275 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.