- PHP can read data with a post method
- First create an input form with a form action:
- <form id="frm_name" name="frm_name" method="post" action="test_form_processor.php">
First Name: <input type="text" name="firstName" id="firstName">
Last Name: <input type="text" name="lastName" id="lastName">
<input type="submit" name="submit" id="submit" value="Submit">
</form>
- Processor page will read the field values and output what is written:
- <?
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
echo "Thank you, ". $firstName . " " . $lastName . "<br />"; ?>
- You can see it in action here
- You can download the actual files here (notice the difference in code from the browser to the php files)