Difference Between Get and Post in Tabular Form

Sno.Basic TermGet Post
1.DefinitionRequests data from a specified resourceSubmits data to be processed to a specified resource.
2.Variables in Php$_GET$_POST
3.Data length2048 charactersNo Limit
4.SecurityLess Security Urls saved in browser history and
server logs in plaintext.
More Secure No saved in browser history and server logs in plaintext.
5.Displayed in UrlYesNo.
6.BookmarkedYesNo.
7.HistoryYes Saved in historyNo.
8.Encoding Type(enctype attribute)application/x-www-form-urlencodedapplication/x-www-form-urlencoded or

multipart/form-data

9.Url Examplehttp://www.example.com/action.php?name=Abhi&age=22http://www.example.com/action.php
10.CachedcachedNever
11.Send Sensitive DataNoYes
12.BACK button/ReloadSame Link is Reload and Then ProcessBefore Reload browser should alert about the re-submitted data
13.Data TypeOnly ASCII characters allowed and non ASCII
characters are Not Alow like (©, ®,™)etc
No restrictions. Binary data is also allowed
14.Using Used with Action

  • Insert
  • Delete
  • Edit
POST method used with.

  • sensitive information
  • passwords
15.Form Submission In Php Example
<?php
$name="";
$age="";
$active=false;
if(isset($_GET["submitform"])){
	$name = $_GET["name"];
	$age = $_GET["age"];
	$active=true;
}
?>
<form method="get">
<input type="text" name="name" placeholder="Enter Name " />
<input type="number" name="age" placeholder="Enter Age " />
<input type="submit" name="submitform" placeholder="Enter Age "/>
</form>
<?php 
if($active){
	echo "Name is ".$name." and age is ".$age;
}
?>

 

<?php
$name="";
$age="";
$active=false;
if(isset($_POST["submitform"])){
	$name = $_POST["name"];
	$age = $_POST["age"];
	$active=true;
}
?>
<form method="post">
<input type="text" name="name" placeholder="Enter Name " />
<input type="number" name="age" placeholder="Enter Age " />
<input type="submit" name="submitform" placeholder="Enter Age " />
</form>
<?php 
if($active){
	echo "Name is ".$name." and age is ".$age;
}
?>

 

(Visited 1,542 times, 1 visits today)
Share with Friends :
Written by:

Leave a Reply

Your email address will not be published. Required fields are marked *