PHP forms Processing



This tutorial explains How to create forms in HTML and accept /process input from user in PHP.





Accept.html


<html>
   <body>
   <form action="display.php" method="POST">
   Name: <br>
   <input type="text" name="user">
   <br>
  Address: <br>
  <textarea name="address" rows="5" cols="40"></textarea>
  <br>
  Select languages: <br>
  <select name="languages[]" multiple >
  <option>C</option>
  <option>Java</option>
 <option>ORACLE </option>
  <option>VB.NET</option>
  </select>

 <input type="submit" value="Submit">
  </form>
  </body>
  </html>



Display.php
<?php
if(isset($_POST['user']))
{
   print "Welcome ".$_POST['user']."<br>";
print "Your address is:".nl2br($_POST['address'])."<br>";
  print "Your language choices are:<br>";

     foreach ($_POST['languages'] as $value) {
       print "$value<br>";
        }
    print $str;   
}
  
  ?>

2 comments:

Thanks for visiting my Blog!

Have a Question ? Need Help in College Assignments, Need Code that is not available here? Just leave a comment & get your code instantly.

Tips to Enhance Your Blog