Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 PHP Help Wanted
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jimmybrion




PostPosted: Thu Aug 25, 2011 7:41 am   Post subject: PHP Help Wanted

Please tell me the difference between $get and $post
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Thu Aug 25, 2011 9:10 am   Post subject: RE:PHP Help Wanted

Here is a good place to start: http://www.google.com/search?q=the+difference+between+get+and+post

And another: http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods
DanShadow




PostPosted: Wed Aug 31, 2011 3:19 am   Post subject: RE:PHP Help Wanted

I'd say a note-worthy difference between GET & POST form methods is variable visibility.

If you submit a form with a text-field element "name" using the GET method, your url will look like this:
http://www.your-url.com/index.php?name=john

If you use the POST method you will not see the "?name=john" at the end.

POST & GET form methods can have specific uses as well.

Say you wanted to post a link on Compsci to your web-site. Since you probably can't create a form on the Compsci forum, you couldn't use the POST method to transfer variable data to your web-site landing page. However, if you use the GET method by structuring your link like this:
http://www.your-url.com/index.php?name=john

You can access the variable $_POST["name"] to retrieve the data, which is "john".
This can of course be extended to accommodate multiple variables, like shown below:

http://www.your-url.com/index.php?name=john&job=programmer&married=false&obvious=true

So the difference is specific to what you need your form to do, and how.
If your simply transferring use data from 1 page to the next, POST (or session vars) will probably be sufficient.
If your doing external linking back to your web-site's landing page, then a GET URL string will likely be necessary.

Hope this helps.
SIL3NTKOD3R




PostPosted: Tue Sep 11, 2012 6:31 am   Post subject: Re: PHP Help Wanted

Think like this:

$_GET means you are telling the server to do something, mainly from url:
(http://localhost/login.php?username=SIL3NTKOD3R)
Meaning that the page will sent request to the server saying the person with username(SIL3NTKOD3R) is trying to login.

$_POST means you are telling the server to do something secretly:
Unlike $_GET, you will not be able to see what the page is requesting to the server.
So the url can be: http://localhost/login.php but its still might be sending request to the server saying the person with username(SIL3NTKOD3R) is trying to login without letting you know.
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: