Answer the question
In order to leave comments, you need to log in
Why doesn't else work?
Why doesn't the fool message appear when submitting an empty form?
<html>
<head>
</head>
<body>
<h1>
Добавление нового пользователя
</h1>
<form method="post" action="adduser.php">
<p>
Введите Имя:
<input type="text" name="name" size="30">
</p>
<p>
Введите Фамилию:
<input type="text" name="surname" size="30">
</p>
<input type="submit">
</form>
</body>
</html>
<?php
if (isset($_POST['name']))
{
$name = $_POST['name'];
echo $name;
}
else
{
echo "fool";
}
?>
Answer the question
In order to leave comments, you need to log in
isset() checks for existence.
Name = '' is always passed in your code.
You can do this: I
recommend using the var_dump function for debugging and checking the states of variables
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question