PHP dealing with forms
PHP is very good at dealing with Forms. Try the following sample.
How to do it?
First copy/past the following code to a HTML file and save it.
<form action="form.php" method="post" "target="_blank">
Input your name
<input type="text" name="name">
Input your phone number
<input type="text" name="phone">
<input type="submit" name="Submit" value="Submit">
</form>
Second,
copy the following code to a file and save it as form.php.
<?php
echo "Welcome $_POST['name'] <br>";
echo "Your number $_POST['phone'] is in our database
now";
$>
$_POST['name'] get the name input and $_POST['phone'] get the phone
input. If you Get method in the above form, you need use $_GET['name']
and $_GET['phone'] instead of $_POST.
Very simple, right?
If you want to save form collected information into database, please
go to insert data into Mysql Database.
|