php userName _POST name userNameCookie str_replace userName if empty u

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
$userName= ($_POST['name']);
$userNameCookie = str_replace(' ', '', $userName);
if (!empty($userName)){
$userCount = (isset($_COOKIE[$userNameCookie])) ? $_COOKIE[$userNameCookie] : 0 ;
$userCount++;
setcookie($userNameCookie,$userCount);
echo "$userName у Вас уже $userCount обновление";
}
?>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form method="POST">
<p> Напишите свое имя</p>
<input type="text" name="name" maxlength = "50" autocomplete="on">
<input type="submit">
</form>
</body>
</html>