-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
82 lines (80 loc) · 2.77 KB
/
Copy pathindex.php
File metadata and controls
82 lines (80 loc) · 2.77 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
<?php
if (!empty($_POST['surname']) && !empty($_POST['name'])){
$name=trim(strip_tags($_POST['name']));
$surname=trim(strip_tags($_POST['surname']));
$rasa=trim(strip_tags($_POST['rasa']));
if (isset($_POST['sex'])){
$sex=$_POST['sex'];
}else {
$sex="<span style='color:red'>Не определился</span>";
}
if(ctype_digit($_POST['phone'])) {
$phone=trim(strip_tags($_POST['phone']));
}else{
$phone = "<span style='color:red'>Пожалуйста введите номер телефона корректно!</span>";
}
$msg= "Имя: $name <br>
Фамилия: $surname <br>
Раса: $rasa <br>
Телефон: $phone <br>
Пол: $sex <br>";
}
else {
$msg = "<span style='color:red'>NUL</span>";
}
if (empty($_POST['name']) || empty($_POST['surname']) || !ctype_digit($_POST['phone']) || !isset($_POST['sex'])){
$push = "<span style='color:red'>NUL</span>";
}
else {
file_put_contents('BD.txt', $msg, FILE_APPEND);
$push= "Запись добавлена";
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="https://use.fontawesome.com/e4534d6c3f.js"></script>
<title>Forms</title>
</head>
<body>
<form method="POST">
<fieldset>
<legend><h3><strong>Паспорт</strong></h3></legend>
<div class="name"><label for="name">Имя</label>
<input type="text" id="name" name="name" placeholder="Вася" value=""><br><br>
<label for="surname">Фамилия</label>
<input type="text" id="surname" name="surname" placeholder="Пупкин" value="">
<br><br>
<label for="ras">Раса</label>
<select value="Раса" id="ras" name="rasa">
<option >Человек</option>
<option >Синт</option>
<option>Гуль</option>
<option>Супермутант</option>
<option>Робот</option>
</select><br>
<br>
<label for="phone">Телефон</label><input type="text" id="phone" name="phone" placeholder="8 555 555 55 55" value="">
</div>
<div class="gender">
<span class="fa fa-transgender-alt" aria-hidden="true"></span><br><br>
<input type="radio" name="sex" id="female" value="Женский"><label for="female"> Женский </label>
<input type="radio" name="sex" id="male" value="мужской"> <label for="male">Мужик</label>
<input type="radio" name="sex" id="nun" value="ХЗ"> <label for="nun">Не понятно</label>
</div>
<div class="clearfix">
<button type="submit">Добавить запись</button>
</div>
</fieldset>
</form>
<div class="test">
Добро пожаловать в сеть "РОБКО Индастриз(ТМ)" <br><br>
<?php
echo $msg;
echo $push;
?>
</div>
</body>
</html>