Dynamic Form Processing in PHP

By | October 31, 2011

Here is a small piece of php code that will process the forms dynamically.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<html>   <head>
    <title>Personalized Hello World</title> 
  </head> 
  <body> 
    <?php if(!empty($_POST['name'])) { 
      echo "Hi there, {$_POST['name']}, and welcome. Your age is {$_POST['age']}.";
    } ?> 
    <form action="<?php $PHP_SELF; ?>" method="post"> 
      Enter your name: <input type="text" name="name" /> 
      Enter your age: <input type="text" name="age" />  
      <input type="submit" /> 
    </form> 
  </body> 
</html>

If you like this article, then please consider sharing it. Sharing really inspires us to do things much better!!

Leave a Reply

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