Web page template using the address bar

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • UFG
    New Member
    • Jul 2007
    • 2

    Web page template using the address bar

    Okay so I'm sure this has been gone over before, but I tried searching and I couldn't find anything about it probably because I have no idea what this is really called.

    Basically, I want to have a web page template, say "gallery.ph p". And I have an image, say "canyon.jpg ". What I want to happen is I want to be able to put "http://blahblah.com/gallery.php?=ca nyon" in my address bar and when i go to that website it has the gallery.php template with canyon.jpg featured in it.

    I hope it's simple, but I'm really bad at figuring stuff out and I've been searching everywhere for it. I just don't know what to search for, haha... Anyway, any help you guys can give me would be great :)
  • developing
    New Member
    • Mar 2007
    • 110

    #2
    search for the 'get' functino in php

    there is an awsome article on this on this site too

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hi, UFG, and welcome to TSDN!

      This is a very simple thing to do. As developing suggested, you want to use the HTTP GET protocol.

      That's as simple as adding a '?varname=value ' to your url.
      For example, if you were to create a page called 'test.php' and link to this page, adding '?name=Atli' to the URL, you can access the value of the 'name' variable by using the $_GET array.

      For example:
      [code=php]
      //---
      // test.php
      //---
      <?php
      if(isset($_GET['name'])) {
      echo "Welcome, ". $_GET['name'];
      }
      else {
      echo "No name was passed in the URL.";
      }
      ?>
      [/code]

      This would print out: Welcome Atli.

      Comment

      • UFG
        New Member
        • Jul 2007
        • 2

        #4
        Hey! Thanks A TON! seriously. That saves me like 3 hours worth of pagemaking! Plus now I can use it for a ton of other stuff that I have planned in the future :]
        You guys are the best, seriously.


        It works! :D

        Comment

        Working...