Jump to content
Sign in to follow this  
Snorkel

What does this code do?

Recommended Posts

Hello All,

This is my first post as I am new to PHP.  I am learning how to develop web apps for education using PHP, CSS and HTML.  I dont know any of those languages.  My question is

what does the following code do/mean?: 

$page = ($_GET['page'])

Share this post


Link to post
Share on other sites

It just sets a variable to another value.  That value comes from $_GET, which holds all of the values that were included in the URL.

  • Like 1

Share this post


Link to post
Share on other sites

$_GET is a called a superglobal in PHP.  It is a wrapper for one to many variables sent via an HTTP request.

HTTP REQUEST: http://www.grammarcaptive.com?hash=30a6836a3f7c5fc57751a61098e5c221&podcast_no=21

 

URL Without a Query String:   http://www.grammarcaptive.com

Query String:  ? +  hash=30a6836a3f7c5fc57751a61098e5c221 + & + podcast_no=21

 

The string literal  '30a6836a3f7c5fc57751a61098e5c221' becomes the value of $_GET['hash']

The number 21 becomes the value of $_GET['podcast_no']

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...