...

View Full Version : Link in PHP



angelali
04-16-2012, 05:11 AM
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=job16929&title=Receptionist&type=latest&tid=

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

tracknut
04-16-2012, 05:30 AM
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:


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

angelali
04-16-2012, 05:56 AM
i have not understood your example, but i know you are giving the right answer, can you give me a better understanding example?

primefalcon
04-16-2012, 06:52 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum