How to use REQUEST with FORM in php


PHP is used with HTML Forms so we can get the form data in php. There are three methods for the form data collection POST, GET and REQUEST. We have shown you a simple example how to use the REQUEST method with HTML FORMS.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example for Using forms in PHP</title>
<!--We will create one simple form with two fields first name and last name-->
<!--This is the simple example for request method with form in php-->
<form name="myform" action="" method="post" id="myform">
<label>First Name</label>
<input type="text" name="fname" id="fname" value="" />

<label>Last Name</label>
<input type="text" name="lname" id="lname" value="" />
<input type="submit" value="Submit" name="save" id="save" />

echo 'Your Name-'.$_REQUEST['fname'].' '.$_REQUEST['lname'];