Jump to content

how do i generate page with "php?="


jaguarr

Recommended Posts

It's to my understanding that you don't have to have all the webpages stored on your servers.  There are pages that are generated dynamically and you can link to it with a question mark after "php". 

 

For example, if you go to google.com and do a search, the result page url will have a question mark, like this:

http://www.google.com/search?hl=en&q=test&btnG=Google+Search

 

How does this work?  An example would be really helpful.  Thanks a lot.

 

Link to comment
https://forums.phpfreaks.com/topic/83437-how-do-i-generate-page-with-php/
Share on other sites

What dynamic pages usually do is take those variables from the url using the $_GET superglobal.

 

If you have page.php?var=3, you do $_GET['var'] to get 3 and you run that through your DB to generate the data for the page.

 

It is pretty simple once you understand the basic idea.

 

website.com/page.php?user=jaguaar

 

SELECT * FROM user WHERE user_name = $_GET['user'] //dont ever do this, but here is an example of how you can use it

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.