Accept form post in php

To accept a html form post in php, you must set the “action” of the html form to the php script and receive html form fields in php using the name of the form field. $_POST is the php global array that holds all the received values.

<html>
<body>
 
<form METHOD="POST" ACTION="FormValue.php">
    <h2>Contact List</h2>
    <br />Nickname:
    <br /><input TYPE="TEXT" NAME="Nickname">
    <br />
    <br />Full Name:
    <br /><input TYPE="TEXT" NAME="Fullname">
    <br />
    <br />Memo:
    <br /><textarea NAME="Memo" ROWS="4" COLS="40" WRAP="PHYSICAL">
    </textarea>
    <br />
    <br />
    <input TYPE="SUBMIT">
</form>
</body>

Save as FormValue.php

1
2
3
4
5
<?php
  echo "<br />Nickname=$_POST['Nickname']";
  echo "<br />Fullname=$_POST['Fullname']";
  echo "<br />Memo=$_POST['Memo']";
?>
Share Article/Example:
  • DotNetKicks
  • DZone
  • StumbleUpon
  • Print
  • Add to favorites
  • Digg
  • del.icio.us
  • Twitter
  • Facebook
  • LinkedIn
  • Posterous
  • Slashdot

 

 
eXTReMe Tracker