Php Data Posting Method get

PHP Get/Post@ Shwetank education.com

PHP Get Method
The inbuilt $_GET variable is used to collect values in a form with method=”get”.

  • Get Only 2KB Data Transfer
  • Get The On URL

Syntax
$_GET[”];

Example Get Method

<form action=”sweta.php” method=”get”>
Name: <input type=”text” name=”nme” />
Password: <input type=”password” name=”pwd” />
<input type=”submit” />
</form>

PHP Post Method
The inbuilt $_POST variable is used to collect values in a form with method=”post”.

  • Post Multiple Data Transfer
  • Do Not Display The Value

Syntax
$_POST[”];

Example POST Method

<form action=”sweta.php” method=”post”>
Name: <input type=”text” name=”nme” />
Password: <input type=”password” name=”pwd” />
<input type=”submit” />
</form>

Basic Example PHP code In Post method
<?php

if(isset($_POST[‘btn’]))

{

$name=$_POST[nme];
$password=$_POST[‘pwd’];
}

?>

$_REQUEST Method

$_REQUEST method can be use both handling get and post method. Request method are send a request to a server.
Note*

  • In the case are you using html code form method in get or post
  • But are you use php code in request method, No Problem Your code is right .
  • Request handle to both get and post.