Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Link in PHP

  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    366
    Thanks
    39
    Thanked 0 Times in 0 Posts

    Link in PHP

    Sometimes I see on some websites, when I click on a link or whatever, the url of the page I get is something like this:

    http://xxx.com/vacancies.php?id=job1...pe=latest&tid=

    Can I know how they made these links? Is it because when you store these links in database, it becomes like this?

  • #2
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,433
    Thanks
    11
    Thanked 303 Times in 302 Posts
    When you pass those parameters on a url, PHP will load them into the $_GET array for you. So for example your code could have something like:
    PHP Code:
    echo "I see you're interested in the ".$_GET['title']." job" 
    So it's a way of providing parameters to a php page, and can be used for a million different things, of course. There's nothing specifically dependent on a database.

    Dave

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    366
    Thanks
    39
    Thanked 0 Times in 0 Posts
    i have not understood your example, but i know you are giving the right answer, can you give me a better understanding example?

  • #4
    Regular Coder primefalcon's Avatar
    Join Date
    Aug 2008
    Location
    /home/primefalcon/
    Posts
    678
    Thanks
    8
    Thanked 39 Times in 39 Posts
    when you see a url like this:

    http://example.com/index.php?name=john

    what its doing is taking the name john and kinda putting it in an envelope (its called a $_GET variable in programming).

    now what happens when the web page loads, the programming on the backend can open the envelope called name to see what data is inside...

    This is a way web pages can keep state and pass info from page to page for example.... to remember that your logged in on a forum or whatever.

    I hope I explained that well enough

    edit: btw the & symbol is actually a seperator so that you can have different envople with data, for example

    example.com?name=john&rank=admin

    and so on


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •