HTML Forms With PHP
HTML Forms With PHP
BY
MAMATA PANDEY
HTML forms
action
Backend script ready to process your passed data.
method
Method to be used to upload data. The most frequently used
are GET and POST methods.
target
Specify the target window or frame where the result of the
script will be displayed. It takes values like _blank, _self, _parent
etc.
All other generic attributes such as id, height, width
etc are also applicable to forms
Form Elements/Controls
<html>
<head>
<title>Password Input Control</title>
</head>
<body>
<form >
User ID : <input type = "text" name = "user_id" /> <br>
Password: <input type = "password" name = "password" />
<textarea rows = "5" cols = "50" name = "description">
Enter description here...
</textarea>
</form>
</body>
</html>
Checkboxes
<html>
<body>
<form method="post">
Enter First Number:
<input type="number" name="number1" /><br><br>
Enter Second Number:
<input type="number" name="number2" /><br><br>
<input type="submit" name="submit" value="Add">
</form>
<?php
if(isset($_POST['submit']))
{
$number1 = $_POST['number1'];
$number2 = $_POST['number2'];
$sum = $number1+$number2;
echo "The sum of $number1 and $number2 is: ".$sum;
}
?>
</body>
</html>
Thank