PHP HTML Form
Posted on: February 17, 2010 at 12:00 AM
Advertisement
In the current tutorial we will study about PHP and HTML form, we will see how to send HTML . We will combine one html file and PHP file to display data. It is a very common application and you can further modify the code using some validation checking etc.

PHP & HTML Form:

In the current tutorial we will study about PHP and HTML form, we will see how to send HTML . We will combine one html file and PHP file to display the contents in PHP file. Whenever we click the submit button, it redirects to the PHP file and PHP file displays the data. You can modify the coding by your own, by putting some validation using JavaScript file.

We will take user's name and city from a html file and display those information on other PHP file.

Example :

PHP file:

<?php

$name=$_GET['name'];

$country=$_GET['country'];

echo "Name is:".$name." and country is:".$country;

?>

HTML file:

<HTML>

<BODY>

<form method="get" action="<?php $_SERVER['PHP_SELF']?>">

Name:<input type="text" name="name"/><br/>

Country:<input type="text" name="country"/><br/>

<input type="submit" value="Submit"/>

</form>

</BODY>

</HTML>

 

Output:

 

Exaplanation:

In the above HTML file we create a HTML form and send the data to PHP file get method. 

Advertisement

Related Tags for PHP HTML Form:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 17, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com