PHP Forms

Submitted by: 

Using the HTML Form is very important in creating a PHP application, because it serves as a holder of information from a website's visitors and then use the PHP to process that information.

Heres the simple HTML Form.

The code below is a simple HTML Form with a two input boxes for Fullname, E-mail Address and a submit button. When the user click the submit button, the data in the form will be sent to the HTTP POST method to be processed in a PHP file called “processData.php”.

  1. <html>
  2. <body>
  3. <h1>Sample HTML Form</h1>
  4. <form action="processData.php" method="post">
  5. FullName:<input type="text" name="fullname"><br>
  6. E-mail Address: <input type="text" name="email"><br>
  7. <input type="submit">
  8. </form>
  9. </body>
  10. </html>


Code for processData.php:

  1. <?php
  2. echo 'Your Fullname is: '.$_POST['fullname'];
  3. echo '<br/>';
  4. echo 'Your Email address is: '.$_POST['email'];
  5. ?>

The code above will simply display the data that has been passed from HTML Form using the superglobal ”$_POST[]” variable. And the output of this application looks like as shown below:

  1. Your Fullname is: Joken Villanueva
  2. Your Email address is: <a href="mailto:[email protected]" rel="nofollow">[email protected]</a>

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.