How to process form in php Reviewed by Momizat on . $_POST,$_GET and $_REQUEST are used to get value from a form control. $_POST:- If method is post of method attribute then use $_POST to get form value. $_GET:- $_POST,$_GET and $_REQUEST are used to get value from a form control. $_POST:- If method is post of method attribute then use $_POST to get form value. $_GET:- Rating: 0

How to process form in php

$_POST,$_GET and $_REQUEST are used to get value from a form control.

  • $_POST:- If method is post of method attribute then use $_POST to get form value.
  • $_GET:- If method is GET of method attribute then use $_GET to get form and url string query value of URL.
  • $_REQUEST:-$_REQUEST is used to get value in both situation (GET,POST and string query) .

Note:-$_FILES is also used to get files related value of type (file) in form.

PHP code (index.php)

<?php
//Here submit is submit button name
if(isset($_POST['submit'])){
// here no1 is name of textbox
echo "your have entered ".$_POST['no1'];
}
?>

HTML Code (index.php)

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>How to process form in php</title>
</head>
<body>
<form method="post" name="f1" id="f1">
<table width="100%" border="0">
<tr>
<td>Enter no1</td>
<td><input type="text" name="no1" id="no1"></td>
</tr> 
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit" id="submit" value="submit"></td>
</tr>
</table>
</form>
</body>
</html>

Leave a Comment

© 2014 Powered By