Practical No.
10
1) Design a web page using following form controls: a.Text box, b. Radio button, c.
Check box, d. Buttons
Html file:
<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<h2>Registration Form</h2>
<form method="get" action="registration_form1.php">
<label>Name:</label>
<input type="text" name="t1" required>
<br><br>
<label>Address:</label>
<textarea name="t2" cols="50" rows="5" required></textarea>
<br><br>
<label>Your Gender:</label>
<input type="radio" name="gender" value="Male" required> Male
<input type="radio" name="gender" value="Female"> Female
<input type="radio" name="gender" value="Other"> Other
<br><br>
<label>Your Hobbies:</label><br>
<input type="checkbox" name="hobbies" value="Cooking"> Cooking
<input type="checkbox" name="hobbies" value="Singing"> Singing
<input type="checkbox" name="hobbies" value="Drawing"> Drawing
<input type="checkbox" name="hobbies" value="Watching T.V"> Watching T.V
<input type="checkbox" name="hobbies" value="Reading Books"> Reading Books
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Php file:
<?php
if(isset($_GET["t1"])) {
echo "Your input is: " . $_GET["t1"] . "<br>";
if(isset($_GET["t2"])) {
echo "Your address is: " . $_GET["t2"] . "<br>";
if(isset($_GET["gender"])) {
echo "Your gender is: " . $_GET["gender"] . "<br>";
}
if(isset($_GET["hobbies"])) {
echo "Your hobbies are: " . implode(", ", $_GET["hobbies"]) . "<br>";
?>
Output: