Why not work header location?

Registration code users. After clicking on the button throws me the path of this file
<?php
 if (isset($_POST['reg'])) {
 $login = htmlspecialchars($_POST['login']);
 $password = htmlspecialchars($_POST ['password']);
 $email = htmlspecialchars($_POST ['email']);
 $bad = false;
session_start();
unset($_SESSION['error_login']);
unset($_SESSION['error_password']);
unset($_SESSION['reg_success']);
 if ((strlen($login) < 3) || (strlen($login) --> 32)) {
 $_SESSION['error_login'] = 1;
 $bad = true;
}
 if ((strlen($password) < 6) || (strlen($password) > 32)) {
 $_SESSION['error_password'] = 1;
 $bad = true;
}
 if (!$bad) {
 $mysqli = new mysqli("localhost", "root", "", "Hunter");
 $password = md5($password);
 $mysqli->query("INSERT INTO users ('login', 'password', 'email') VALUES ('$login', '$password', '$email')");
$mysqli->close();
 $_SESSION['reg_success'] = 1;
 header("Location: index.php");
}
}
?>
June 26th 19 at 14:02
1 answer
June 26th 19 at 14:04
where throws?
what's in $_POST?
a clean white sheet. In the path you specify this file with the code. In the post - the name of kopki - Linda.Klocko commented on June 26th 19 at 14:07
I am not a mind reader, so give information at least in an understandable format.
>The way you specify this file with the code
where is the way?

> In the post - the name of kopki
var_dump($_POST) - mina50 commented on June 26th 19 at 14:10
: isset is not suitable?
The code I wrote above is in the file reg.php (the registration folder)
Fill the data click is redirected along the way registration/reg.php (well sobsna there's a white blank sheet
C when you var_dump gives string(22) "R RRR SR°C†RES" - Linda.Klocko commented on June 26th 19 at 14:13
so far seen in the Post data is missing the form. they just fall into it? - mina50 commented on June 26th 19 at 14:16
how to know whether? in action the path to the halyard (registration/reg.php) method - post. - Linda.Klocko commented on June 26th 19 at 14:19
<input> should be inside
- mina50 commented on June 26th 19 at 14:22
: : of course, inside. In my login form, code similar. Everything works. I don't understand why the redirection is not happening - Linda.Klocko commented on June 26th 19 at 14:25
: var_dump($_POST) cannot issue string(22) "R RRR SR°C†RES" only if not done above
$_POST = $_POST['reg'] - mina50 commented on June 26th 19 at 14:28
: The thing is, was redirected, you need a / before the file - Linda.Klocko commented on June 26th 19 at 14:31

Find more questions by tags PHP