How to Send Receive HTML form data from one page to another using PHP

How to pass value of form on submit button click and receive using $_post method to display on next screen.

In this tutorial we are creating two php programming files, The first one file contains an HTML form with two input boxes and submit button. Now we are setting up form action as the second php page that will receive the sent value using $_post method of php and setting up that particular value on screen using echo function. So here is the complete step by step tutorial for How to Send Receive HTML form data from one page to another using PHP.

android-project-download-code-button

How to Send Receive HTML form data from one page to another using PHP.

Code for sending-data.php file.

 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>How to Send Receive HTML form data from one page to another using PHP</title>
</head>

<body>

<table>
<form action="receiving-data.php" method="post">
<tr>
<td> Name: </td><td><input type="text" name="name"></td>
</tr>
<tr>
<td> E-mail: </td><td><input type="text" name="email"></td>
</tr>
<tr>
<td><input type="Submit"></td></tr>

</form>
</table>

</body>
</html>

Code for sending-data.php file.

 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Receving data file</title>
</head>

<body>

<!--Receiving name-->
<h3>Name is <?php echo $_POST["name"]; ?></h4></br>

<!--//Receiving E-mail-->
<h3>E-mail address is <?php echo $_POST["email"]; ?></h3>

</body>
</html>

Screenshot:

How to Send Receive HTML form data from one page to another using PHP

Click here to download How to Send Receive HTML form data from one page to another using PHP project files with source code.

Leave a Reply

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