Locked lesson.
About this lesson
Let's build out the form to make it work.
Exercise files
Download this lesson’s related exercise files.
Making The Form Work.docx59.2 KB Making The Form Work - Solution.docx
60.2 KB
Quick reference
Making the Form Work
Let's make our form actually post data.
When to use
Anytime you have a form, it should do something!
Instructions
To create hidden form fields:
<input name="num1" type="hidden" value="<?php echo $num1; ?>">
<input name="num2" type="hidden" value="<?php echo $num2; ?>">
To test whether or not the form has been submitted:
if (!$_POST["num1"]) {} else {
echo $_POST["num1"] . " + " . $_POST["num2"] . " = " . $_POST["answer"];
}
Hints & tips
- $_POST["answer"];
- <input name="num1" type="hidden" value="<?php echo $num1; ?>">
Lesson notes are only available for subscribers.