The problem is as follows:
Form.php file:
<?php session_start(); ?>
<form action="x.php" method="post">
<?php
$_SESSION["urlName"] = $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"];
echo $_SESSION["urlName"];
?>
<input type="email">
<button type="submit"></button>
</form>
x.php file:
<?php
require("redirect.php");
$urlName = $_SESSION["urlName"];
if(isset($_SESSION["urlName"]))
echo $urlName;
else
echo "URL NÃO encontrada";
pageRedirect($urlName);
File redirect.php:
<?php
function pageRedirect($urlName){
header("Location: " . $urlName);
die();
}
Value received on $urlName
:
"192.168.x.xx: xxx / project / site-x / index.php"
Type: String
ERROR MESSAGE:
This page is not working 192.168.x.xx has sent an invalid response. ERR_INVALID_REDIRECT
*
OBS: Not a duplicate of Undefined variable: _SESSION , are different issues.
Hosts file:
# copyright (c) 1993-2009 microsoft corp.
#
# this is a sample hosts file used by microsoft tcp/ip for windows.
#
# this file contains the mappings of ip addresses to host names. each
# entry should be kept on an individual line. the ip address should
# be placed in the first column followed by the corresponding host name.
# the ip address and the host name should be separated by at least one
# space.
#
# additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# for example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within dns itself.
# 127.0.0.1 localhost
# ::1 localhost