Introduction to Forms in PHP

Estudies4you
Introduction to Forms in PHP

Forms Introduction

PHP forms are similar to HTML forms and are used to validate data and to collect data from the form.
You use the Get and Post variables to get the information from the form automatically.
Forms Introduction

Note: You don't have to write separate PHP script to get values from the HTML form, it will be taken automatically.

Writing Forms
Scripting for Form
·         A Write the PHP script with HTML form to take value from the form automatically
·         A Save the file with the form name and .php extension

Example
<form action="welcome.php" method="post">
Name of the car you haVe<input type="text" name="carname">
from when you are the owner: <input type="text" name="year of purchase"›
 <input type="submit">
</form>
I have <?php echo $_POST["carname"];?>!<br>
I am having it from <?php echo $ POST["year of purchase"]; ?>

Forms Introduction



To Top