-
-
Save dertst/f6aeb88159d4075251b888711ed3eeb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<h1>Форма регистрации</h1> | |
<title>header</title> | |
</head> | |
<body> | |
<p>Введите логин и пароль.</p> | |
<?php | |
if(isset($_POST["knopka"]) && !empty($_POST["knopka"])) | |
{ | |
$errors = ""; | |
$login = htmlspecialchars($_POST["login"]); | |
$pass = htmlspecialchars($_POST["pass"]); | |
$pass1 = htmlspecialchars($_POST["pass1"]); | |
$email = htmlspecialchars($_POST["pochta"]); | |
$age = htmlspecialchars($_POST["age"]); | |
$radio = htmlspecialchars($_POST["sex"]); | |
$radio1 = htmlspecialchars($_POST["sex"]); | |
} | |
if(empty($login)) | |
{ | |
$errors .= "Введите логин.<br>"; | |
} | |
if(empty($pass) || $pass != $pass1) | |
{ | |
$errors .= "Не был введён пароль или они не совпадают <br>"; | |
} | |
if($age < 18 || $age > 90) | |
{ | |
$errors .= "Введите корректный возраст <br>"; | |
} | |
if(empty($email)) | |
{ | |
$errors .= "Введите электронную почту <br>"; | |
} | |
if(empty($radio) && empty($radio1) ) | |
{ | |
$errors .= "Вы не ввели пол.<br>"; | |
} | |
?> | |
<div id = "errors"> | |
<?=$errors?> | |
<form action = "reg.php" method = "POST" type = ""><br> | |
E-mail: | |
<input type = "email" name = "pochta"><br> | |
Введите возраст: | |
<input type = "number" name = "age" ><br> | |
Укажите пол: | |
<label><input type = "radio" name = "sex">Мужской </label> | |
<label><input type = "radio" name = "sex">Женский</label><br> | |
Логин: | |
<input type = "text" name = "login"><br> | |
Пароль: | |
<input type="password" name = "pass"><br> | |
Введите пароль повторно: | |
<input type = "password" name = "pass1"><br> | |
<input type ="submit" name = "knopka" value = "Зарегистироваться"><br> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment