how can I differentiate POST and GET?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jeevanism
Forum Newbie
Posts: 14
Joined: Fri Dec 09, 2011 12:12 am

how can I differentiate POST and GET?

Post by jeevanism »

I am so newbie to the php , consider a dummy. I have this doubt always. How can I differentiate a GET and POST when I see the source code? I just know this GET pass plain url while POST wont. so POST is more secure than GET. besides this, how can I understand seeing the php code whether its code line is using GET or POST method?


Any help??
4bdulmobeen
Forum Newbie
Posts: 1
Joined: Wed Jan 11, 2012 12:24 pm

Re: how can I differentiate POST and GET?

Post by 4bdulmobeen »

the method of the form will tell you weather it is sending data via GET or POST
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how can I differentiate POST and GET?

Post by social_experiment »

jeevanism wrote:how can I understand seeing the php code whether its code line is using GET or POST method?
POST data is accessed via the $_POST associative array, same goes for $_GET;

Code: Select all

<?php
 // data from POST
 $data = $_POST['data'];
 
 // data from GET
 $gData = $_GET['gData'];
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply