Above is just a plain old static HTML form, below points out the juicy bits:
The HTML <form action="message_tutorial.php" method=post> dictates which PHP script will process the input from the from, in other words, it's what makes the form work or do anything at all! Post is the method in which the data is sent from the form to the PHP script; we shall look at this later.
Input type="text" creates a text box element on the form (where the user inputs their data). Name="FirstName" - The data that the user inputs here will be stored in a variable called "YourName." Can you start to see the importance of variables in forms now?
<input type="text" name="Message"> creates another text field that creates a variable called "Message" that will store the users message.
<input type="submit" name="submit" value="Submit"> creates a submit button, that the user will click.
</form> ends the form.
So now we have a way of collecting the user's input, we need to do something useful with it! You can use the echo or print command to output the variables contents on another page. In some cases it might be preferable to do all of this in one PHP script.
When the user clicks the submit button "message_tutorial.php" is loaded. Here is "message_tutorial.php" or see this code in this paste bin:
<html>
<head>
<title>Here is your message</title>
</head>
<?php
// Get the values from the form, "FirstName" and "Message"
$FirstName = $_REQUEST['FirstName'] ;
$Message = $_REQUEST['Message'] ;
?>
<p>
Hey, <?php print $FirstName; ?>
<p>
Your message is <b> <?php echo $Message; ?></b>
<p>
</body>
</html>