-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeach_post_form.php
More file actions
110 lines (105 loc) · 3.79 KB
/
Copy pathforeach_post_form.php
File metadata and controls
110 lines (105 loc) · 3.79 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
function validate()
{
/* var uname=document.getElementById('u').value;
var pass=document.getElementById('p').value;
if (length.uname>5 && length.uname<10)
{
document.getElementById('uu').innerHTML+="invalid length(5<10)";
document.getElementById('uu').style.color="red";
}
else
{
document.getElementById('uu').innerHTML+="valid length(5<10)";
document.getElementById('uu').style.color="green";
} */
}
</script>
<title>foreach with post</title>
</head>
<body>
<form method="POST">
<table>
<tr>
<th>UserName: </th>
<br><th>Password: </th>
</tr>
<tr>
<td id="uu">                ↓</td>
<td id="pp">                ↓</td>
</tr>
<tr>
<td><input type="text" name="user" id="u" placeholder="enter username"></td>
<td><input type="password" name="pass" id="p" placeholder="******"></td>
</tr>
<tr>
<td><span>MALE:</span><input type="radio" name="gender" id="male"></td>
<td><span>FEMALE: </span><input type="radio" name="gender" id="female"></td>
</tr>
<tr>
<td><span>JAVA</span><input type="checkbox" name="lang[]" value="java"></td>
<td><span>JAVASCRIPT</span><input type="checkbox" name="lang[]" value="javascript"></td>
</tr>
<tr>
<td><span>PYTHON</span><input type="checkbox" name="lang[]" value="python"></td>
<td><span>C++</span><input type="checkbox" name="lang[]" value="C++"></td>
</tr>
<tr>
<td><span>***</span></td>
<td><span>***</span></td>
</tr>
<tr>
<td><input type="reset" name="reset" id="res" value="clear form"></td>
<td><input type="submit" name="submit" id="sub" value="submit form" onclick="validate();"></td>
</tr>
</table>
<br><br><br><br><br><br>
</form>
<?php
if(isset($_POST))
{
print_r($_POST);
}
else
{
echo("else ");
}
if($_POST['submit form']=='submit')
{
echo(" ");
}
else
{
if(is_array($_POST))
{
foreach($_POST as $val)
{
echo $val;
}
}
else
{
echo($_POST);
}
}
/* if(is_array($_POST))
{
foreach($_POST as $p)
{
echo ($p);
}
}
else
{
echo("else".$_POST);
}
*/
?>
</body>
</html>