2 changed files with 60 additions and 0 deletions
@ -0,0 +1,33 @@ |
|||
<!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"> |
|||
<title>Formulář</title> |
|||
</head> |
|||
<body> |
|||
<h1>PHP formulář</h1> |
|||
|
|||
<form action="pozdrav.php" method="post" target="_blank"> |
|||
<label for="name">Jméno:</label> |
|||
<input type="text" name="name" id="name"><br> |
|||
<label for="mail">E-mail:</label> |
|||
<input type="email" name="mail" id="mail"> <br> |
|||
<label for="comment">Komentář</label> <br> |
|||
<textarea name="comment" id="comment" cols="20" rows="5">Vložte komentář</textarea> |
|||
<br> |
|||
<label for="color">Oblibena barva</label> |
|||
<select id="color" name="color"> |
|||
<option value="red">Červená</option> |
|||
<option value="blue">Modrá</option> |
|||
<option value="green">Zelená</option> |
|||
<option value="purple">Fialová</option> |
|||
</select> <br> |
|||
<label for="pw">Heslo:</label> |
|||
<input type="password" name="pw" id="pw"> |
|||
<br> |
|||
<input type="submit" value="Odeslat Pozdrav"> |
|||
</form> |
|||
</body> |
|||
</html> |
@ -0,0 +1,27 @@ |
|||
<?php |
|||
$name = $_POST["name"]; |
|||
$mail = $_POST["mail"]; |
|||
$comment = $_POST["comment"]; |
|||
$color = $_POST["color"]; |
|||
|
|||
if($_POST["pw"] != "asd"){ |
|||
header("Location: /"); |
|||
} |
|||
|
|||
?> |
|||
|
|||
<!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"> |
|||
<title>Document</title> |
|||
</head> |
|||
<body> |
|||
<h1>Ahoj, <?php echo $name ?> </h1> |
|||
<h3>použitý email je <?php echo $mail ?> </h3> |
|||
<h3>Oblíbena barva: <?php echo $color ?> </h3> |
|||
<p><b>Komentář:</b> <?php echo $comment ?> </p> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue