forked from 4iz278/cviceni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02-formular-post.php
35 lines (29 loc) · 1.07 KB
/
02-formular-post.php
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
<!DOCTYPE html>
<html>
<head>
<title>Ukázka HTML formuláře</title>
<meta charset="UTF-8"/>
</head>
<body>
<h1>Ukázka jednoduchého formuláře posílaného metodou POST</h1>
<form method="post">
<label for="jmeno" >Jméno</label>
<input type="text" name="jmeno" id="jmeno" value="<?php echo htmlspecialchars(@$_POST['jmeno']);?>" />
<label for="prijmeni" >Příjmení</label>
<input type="text" name="prijmeni" id="prijmeni" value="<?php echo htmlspecialchars(@$_POST['prijmeni']);?>" />
<label for="vek" >Věk</label>
<input type="number" name="vek" id="vek" value="<?php echo htmlspecialchars(@$_POST['vek']);?>" min="0" max="150" step="1" />
<label for="mail">E-mail</label>
<input type="email" name="mail" id="mail" value="<?php echo htmlspecialchars(@$_POST['mail'])?>"/>
<input type="submit" value="Odeslat..."/>
</form>
<?php
if (!empty($_POST)){
echo '<h2>Odeslaná data</h2>';
echo '<pre>';
var_dump($_POST);
echo '</pre>';
}
?>
</body>
</html>