Read text field input from in PHP

Description

The following code shows how to read text field input from.

Example


<html>//from   w w  w .j a v  a 2s  . c o  m
<body>
<form action="formAction.php" method="post">
Your name: <input type="text" name="YourName"><br>
Cost of a lunch: <input type="text" name="CostOfLunch"><br>
Days buying lunch: <input type="text" name="DaysBuyingLunch"><br>
<input type="submit" value="Compute">
</form>
</body>
</html>

//formAction.php
/*
<?php
  $Today = date("l F d, Y");
?>
<html>
<body>
Today's date:
<?php
  print("<h3>$Today</h3>\n");

  print($_REQUEST['YourName'] . ", you will be out ");
  print($_REQUEST['CostOfLunch'] * $_REQUEST['DaysBuyingLunch']);
  print(" dollars this week.<br>\n");
?>
</body>
</html>
*/




















Home »
  PHP Tutorial »
    Form »




PHP Form
Form Demo