Using PHP you can respond or process the data to be submitted by HTML form i.e. information will be gathered by HTML form and further processed by PHP, thus you can create dynamic web page using PHP. For that we can use $_GET or $_POST variable.

Lets us see an example on from handling using PHP. First file is created named Registration i.e. a HTML form to collect data from user and later that will be send to PHP script. You can use either POST or GET method to send data.

Registration.html :

<head><h2>Registration Form </h2></head>
	<FORM name="frmRegistration" method="POST" action="frmDisplay.php">
	<table border="1">
			<tr><td> Enter Name          :  </td> <td> <input type="text" name="txtName"> </td></tr>
			<tr><td> Enter Phone Num     :  </td> <td> <input type="text" name="txtPhone"> </td></tr>
			<tr><td> Select Gender       :  </td>
			 <td>   <input type="radio" name="rdoGender" value="MALE">MALE <br> 

		 	<input type="radio" name="rdoGender" value="FEMALE">FEMALE
			<tr><td> Enter Address          :  </td> <td> <input type="textarea" name="txtAdd" size="30"> </td></tr>
			<tr><td> Select City            :  </td> <td> <select name="sCity" width=40>
			<option name="1"> Canada
			<option name="2"> Mumbai
			<option name="3"> New York
			<option name="3"> Washigton


			<tr><td>Education : </td><td><input type="checkbox" name="e[]" value="BCOM"> BCOM </td> </tr>
			<tr><td></td><td><input type="checkbox" name="ed[]" value="BBA"> BBA </td> </tr>
			<tr><td></td><td><input type="checkbox" name="ed[]" value="BCA"> BCA </td> </tr>
			<tr><td></td><td><input type="checkbox" name="ed[]" value="BA"> BA </td> </tr>
			<tr><td></td><td><input type="checkbox" name="ed[]" value="MA"> MA </td> </tr>
			<tr><td></td><td><input type="checkbox" name="ed[]" value="MCOM"> M.COM </td> </tr>
			<tr><td></td><td><input type="checkbox" name="ed[]" value="MCA"> MCA </td> </tr>
			<tr><td></td><td><input type="checkbox" name="ed[]" value="MPharm"> MPharm </td> </tr>
			<tr><td></td><td><input type="checkbox" name="ed[]" value="PhD"> PhD </td> </tr>

			<tr> <td colspan=2 align="center"> <input type="submit" name="submitForm" value="Submit"> </td></tr>		

After that we will create one PHP script that will display the data entered through above html file.

frmDisply.php :


	$Name = $_POST["txtName"];
	$Phone = $_POST["txtPhone"];
	$Gender = $_POST["rdoGender"];
	$Address = $_POST["txtAdd"];
	$Education = $_POST["ed"];
	$City = $_POST["sCity"];

	echo "<table border='1'>";
	echo "<tr><th  colspan='2'> REGISTRATION DETAILS </th></tr>";
	echo "<tr><td>Name :</td><td>$Name</td></tr>";

	echo "<tr><td>Phone :</td><td>$Phone</td></tr>";
	echo "<tr><td>Gender :</td><td>$Gender</td></tr>";
	echo "<tr><td>Address : </td><td>$Address</td></tr>";	
	echo "<tr><td>City</td><td>$City</td></tr>";
	echo "<tr><td>Educational Qualification : </td>	<td> ";
		foreach ($Education as $Edu=>$value) 
		            echo $value."<br />";
	      echo "</td></tr>";

	echo "</table>";


Output :