Почему echo выводит всегда 0?
<?php
//header('Content-Type: text/html; charset=utf-8');
/*
if(!empty($_GET['name'])){
setcookie('user_name', $_GET['name']);
}
if(!empty($_COOKIE['user_name'])){
echo $_COOKIE['user_name'];
}
*/
$size = 14;
if(!empty($_COOKIE['text_size'])){
$size = (int)$_COOKIE['text_size'];
}
if(!empty($_POST['size'])){
$size = (int)$_COOKIE['size'];
setcookie('text_size', $size);
}
echo $size;
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5</title>
<style>
.size{
font-size: <?php echo $size?>px;
}
</style>
</head>
<body>
<form method="post">
<label for="size">Размер шрифта</label>
<select id="size" name="size">
<option value="14">14</option>
<option value="30">30</option>
<option value="70">70</option>
</select>
<button type="submit">Применить</button>
</form>
<p class="size">Добро пожаловать</p>
</body>
</html>
$size = (int)$_COOKIE['size'];
->$size = (int)$_POST['size'];