Buon pomeriggio a tutti...
Anche io praticando con PHP e con lo stesso problema di MiDDiO
la funzione header() non funziona.
L'errore nel file log è il seguente:
[Thu May 18 16:09:10.598692 2017] [proxy_fcgi:error] [pid 23664] [client 95.17.221.195:50647] AH01071: Got error 'PHP message: PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/vhosts/MYSITE.com/httpdocs/test/loadcountry.php:1) in /var/www/vhosts/MYSITE.com/httpdocs/test/loadcountry.php on line 3
PHP message: PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/vhosts/MYSITE.com/httpdocs/test/loadcountry.php:1) in /var/www/vhosts/MYSITE.com/httpdocs/test/loadcountry.php on line 3
PHP message: PHP Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/MYSITE.com/httpdocs/test/loadcountry.php:1) in /var/www/vhosts/MYSITE.com/httpdocs/test/loadcountry.php on line 8\n', referer: http://MYSITE.com/test/
e questo il codice della pagina loadcountry.php
<?php
session_start();
$setcountry = $_POST["country"];
$_SESSION["setcountry"] = $setcountry;
$_SESSION["setcity"] == '';
header("location: index.php");
exit;
?>
L'unico modo di eseguire il redirect è inserendo un comando html
echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php#form\" />";
però in questo caso il valore delle variabili di sessione è null!!!!!
Un saluto e un grazie a tutti



Rispondi quotando
