Google+ PHP TUTORIALS ONLINE HELP FOR MEDICAL AND PROGRAMMING: PHP Form Handling

Monday 17 February 2014

PHP Form Handling

PHP Form Handling

We are going to discus How to use PHP Form Handling. In this below example we have displays a simple  HTML form, and displays for Four Input Fields and submit button. After that user fills all input fields and click the submit button, the form data is send for processing to a PHP files named "Display.php". We use for post method, Post methods is send data HTTP.
We have used echo() method. Echo is a language construct and we can use without parameter parentheses:
Syntax
  <?php echo $_POST["Firstname"]; ?>
Form.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Handling</title>
</head>
<h>PHP Form Handling</h>
<body>
<pre>
<form action="Display.php" method="post">
First Name: <input type="text" name="Firstname" id="fname">
Last Name: <input type="text" name="lastname" id="lname">
Address: <input type="text" name="address" id="address" />
Mobile No: <input type="number" name="number" id="number"/>
<input type="submit" name="submit" /> 
</form> 
</pre>
</body>
</html>
Dispaly.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP welcome page</title>
</head>

<body>
Your First name is: <?php echo $_POST["Firstname"]; ?><br>
Your Last name is: <?php echo $_POST["lastname"]; ?><br>
Your Address is: <?php echo $_POST["address"]; ?><br>
Your Mobile number is: <?php echo $_POST["number"]; ?>
</body>
</html>

You can see below OutPut

No comments:

Post a Comment