0% found this document useful (0 votes)
24 views1 page

Processing Form

This document discusses processing forms with PHP and using a single PHP page to both generate and process a form. It provides an example of a self-processing form that takes two numbers as input and displays their sum.

Uploaded by

vsh36368
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Processing Form

This document discusses processing forms with PHP and using a single PHP page to both generate and process a form. It provides an example of a self-processing form that takes two numbers as input and displays their sum.

Uploaded by

vsh36368
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Chapter 1.

Web Techniques

1.1 Processing Forms


It's easy to process forms with PHP, as the form parameters are available in the $_GET and
$_POST arrays.
1.3.3. Self Processing form
One PHP page can be used to both generate a form and process it.
<html>
<head> <title> SELF PROCESSING FORM </title> </head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="GET">
<center> Simple Calculator for Addition<br>
<b>Enter the first number</b> <input type="text" name="num1"><br>
<b>Enter the second number</b> <input type="text" name="num2"><br>
<input type="submit" name=add value="Addition">
</form>
<?php
if($_GET['add']=="Addition")
{
$num1=$_GET['num1'];
$num2=$_GET['num2'];
$add=$num1+$num2;
echo "<br> <input type=text value=$add>";
}
?>
</body>
</html>

You might also like