-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform-multi-buttons-with-family.php
More file actions
50 lines (46 loc) · 1 KB
/
form-multi-buttons-with-family.php
File metadata and controls
50 lines (46 loc) · 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
// print count([1, 2]);
// $a = [1, 2, 3, 4];
// print count($a);
if (count($_POST) > 0) {
// print_r($_POST);
// exit();
if (isset($_POST["family"])) {
$family = trim($_POST["family"]);
if (isset($_POST["send1"])) {
header("Location: sender1.php?family1=$family");
exit();
}
else if (isset($_POST["send2"])) {
header("Location: sender2.php?family2=$family");
exit();
}
else if (isset($_POST["send3"])) {
header("Location: sender3.php?family3=$family");
exit();
} else {
print "Error: one of buttons must to be click!";
}
} else {
print "Error: family required!";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<form action="" method="POST">
<b>Family:</b>
<input type="text" name="family" required="">
<br>
<button name="send1">send 1</button>
<button name="send2">send 2</button>
<button name="send3">send 3</button>
</form>
</body>
</html>