Answer» Dear friends,
I am TRYING to insert a redirect command in php but it doesn't function. I can see only an empty page.
The line is:
header( "Location: http://www.articaviaggi.com/thankyou.html" );
the page .../thankyou.html exists and I have loaded it on my website as usual.
Where is the error ?
Many thanks
BenedettoPlease post the entire script. Are there any lines above this one?Hi Rob, thanks a lot for your help. This is the script (remember that all the comments are in italian).
$nome = trim($_REQUEST['nome']); $cognome = trim($_REQUEST['cognome']); $telfisso = trim($_REQUEST['telfisso']); $email = trim($_REQUEST['email']);
$errore = ""; if ($nome == "") { $errore .= " Devi inserire il nome"; } if ($cognome == "") { $errore .= "Devi inserire il cognome"; } if ($telfisso == "") { $errore .= "Devi inserire il telefono fisso"; } if ($email == "") { $errore .= "Devi inserire l'indirizzo email"; }
//Se la variabile errore non è vuota (ovvero almeno uno dei CAMPI obbligatori // è stato lasciato vuoto) visualizzo un messaggio di errore if ($errore <> ""){ //Creo una lista puntata con class errors dove con il css posso //dare un carattere rosso e la inserisco in una variabile $stampaErrori = ''; $stampaErrori .= $errore; $stampaErrori .= " "; //Stampo un riquadro con dentro la lista errori echo ''; echo 'Attenzione!'; echo $stampaErrori; echo 'Torna indietro[/url] '; echo ''; } else { //Se invece non ci sono campi obbligatori vuoti //Creo il testo del messagigo che verrà inviato a noi $messaggio .="Richiesta di contatto "; $messaggio .= "Nome: ".$nome." "; $messaggio .= "Cognome: ".$cognome." "; $messaggio .= "Telefono Fisso: ".$telfisso." "; $messaggio .= "Indirizzo Email: ".$email." "; //controllo che i campi non obbligatori sono compilati, se si li aggiungo al messaggio if ($_REQUEST['indirizzo'] <> "") { $messaggio .= "Indirizzo: ".$_REQUEST['indirizzo']." "; } if ($_REQUEST['codpostale'] <> "") { $messaggio .= "Cod. Postale: ".$_REQUEST['codpostale']." "; } if ($_REQUEST['citta'] <> "") { $messaggio .= "Città: ".$_REQUEST['citta']." "; } if ($_REQUEST['cellulare'] <> "") { $messaggio .= "Cellulare: ".$_REQUEST['cellulare']." "; } if ($_REQUEST['pacchetti'] <> "") { $messaggio .= "Pacchetto: ".$_REQUEST['pacchetti']." "; } if ($_REQUEST['periodo'] <> "") { $messaggio .= "periodo: ".$_REQUEST['periodo']." "; } //if ($_REQUEST['indirizzo'] <> "") { $messaggio .= "Indirizzo: ".$_REQUEST['indirizzo']." "; } //if ($_REQUEST['indirizzo'] <> "") { $messaggio .= "Indirizzo: ".$_REQUEST['indirizzo']." "; } //if ($_REQUEST['indirizzo'] <> "") { $messaggio .= "Indirizzo: ".$_REQUEST['indirizzo']." "; } //invio la mail mail( "[emailprotected]", "Messaggio di richiesta Informazioni ", $messaggio, "From: $email" ); //faccio un redirect ad una PAGINA di ringraziamento header( "Location: http://www.articaviaggi.com/thankyou.html" ); } ?>
Best regards
Benedetto
That script works for me, I'm afraid. Could you TRY putting some test echo "here"; COMMANDS into the script to find out how far it's actually getting? The most likely problem is at the mail command. Are you sure your server is set up correctly to handle mail?Yes, I will contact my server. it is the best way, I think. Thank you very much.
Benedetto
|