Can't send page?

Hello. I use OpenServer and the site lies
C:\openserver\domains\localhost\mysiteproject.com after auth.php not identical after the removal of the password must fall in reg.php which is in that folder
require_once 'database_connect.php';

$name = $_POST['name'];
$surname = $_POST['surname'];
$email = $_POST['email'];
$password1 = sha1($_POST['password1']);
$password2 = sha1($_POST['password2']);

if($password1 === $password2){
$insert = "INSERT INTO FirstTable (name, surname, email, password) VALUES ('$name', '$surname', '$email', '$password1')";
$query = mysqli_query($connect, $insert);
} else {
header("Location:" . "$_SERVER['DOCUMENT_ROOT']" . "/reg.php"); // ???
exit;
}
but:
Parse error: syntax error, unexpected " (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\OpenServer\domains\localhost\mysiteproject.com\auth.php on line 14
please help :(
June 10th 19 at 14:26
1 answer
June 10th 19 at 14:28
Solution
To start, remove a bunch of tags not related to the subject.

header("Location:" . $_SERVER['DOCUMENT_ROOT'] . "/reg.php"); 
// quotation marks when concatenating with variables not needed
Yes, but the error
Warning: Cannot modify header information - headers already sent by (output started at C:\OpenServer\domains\localhost\mysiteproject.com\app_config.php:3) in C:\OpenServer\domains\localhost\mysiteproject.com\auth.php on line 14 - Dewitt_Miller80 commented on June 10th 19 at 14:31
Thank you !!! - Dewitt_Miller80 commented on June 10th 19 at 14:34
Yes , but: first not an error but a warning, the second before you write something, learn the basic syntax and methods of work functions and learn to use Googleand to read what is written in the error. - lily.Kozey commented on June 10th 19 at 14:37

Find more questions by tags PHP