-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetFormData.php
More file actions
34 lines (33 loc) · 1.1 KB
/
Copy pathGetFormData.php
File metadata and controls
34 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Get Form Data</title>
<style>
input[type='text'],input[type='radio'],label{
display: block;
margin-bottom: 5px;
}
input[type='radio']{
display: inline;
}
</style>
</head>
<body>
<form method="GET" action="<?= $_SERVER['PHP_SELF'] ?>">
<input name="name" type="text" placeholder="Name..."/>
<input name="age" type="text" placeholder="Age..."/>
<label><input type="radio" name="radio" value="male"/>Male</label>
<label><input type="radio" name="radio" value="female"/>Female</label>
<input type="submit" value="Submit" name="submit"/>
</form>
<?php
if (isset($_GET['submit'])) {
$name = $_GET['name'];
$age = $_GET['age'];
$sex = $_GET['radio'];
echo 'My name is '.$name.'. I am '.$age.' years old. I am '.$sex.'.';
}
?>
</body>
</html>