OVH Cloud OVH Cloud

Avant de craquer:

5 réponses
Avatar
shmol
Coucou je ne m'en sort pas... A l'aide


Voici le message d'erreur:

Warning: Cannot modify header information - headers already sent by (output
started at /home/httpd/vhosts/solana-asso.com/httpdocs/contact.php:5) in
/home/httpd/vhosts/solana-asso.com/httpdocs/contact.php on line 17


Voici le code:


<html>

<head>

</head>

<body>

<?

import_request_variables('p', 'p_');

$text="nom: ".$p_nom.chr(10).chr(13)."Prenom:
".$p_prenom.chr(10).chr(13)."Mail: ".$p_mail.chr(10).chr(13)."Tel:
".$p_telephone.chr(10).chr(13)."Choix: ".$p_choix.chr(10).chr(13)."Message:
".$p_message.chr(10).chr(13);

$headers = 'From:'.$p_nom.'<'.$p_mail.'>'."\n";

if($p_choix=="Adoptions") {

mail("adoption@solana-asso.com", "Demande Adoptions",$text,$headers);}

if($p_choix=="Abandons") {

mail("julien@solana-asso.com", "Demande Abandons",$text,$headers);}

if($p_choix=="Solana") {

mail("contact@solana-asso.com", "Demande Infos Solana",$text,$headers);}

if($p_choix=="Autre") {

mail("contact@solana-asso.com", "Formulaire Solana",$text,$headers);}

header("Location:merci.htm");

?>

</body>

</html>

5 réponses

Avatar
CrazyCat
shmol wrote:
Coucou je ne m'en sort pas... A l'aide
Warning: Cannot modify header information - headers already sent by (output
started at /home/httpd/vhosts/solana-asso.com/httpdocs/contact.php:5) in
/home/httpd/vhosts/solana-asso.com/httpdocs/contact.php on line 17
Voici le code:
<html>



...

header("Location:merci.htm");
?>



Tu ne peux pas faire un header() alors que tu as déjà envoyé du contenu
au navigateur.
Vire toutes tes balises HTML qui ne servent à rien et ça tournera.

--
Astuces informatiques: http://www.crazycat.info
Tchattez en liberté: http://www.crazy-irc.net
Avatar
shmol
Oups je refais:

code:

<html>
<head>
</head>
<body>
<?
import_request_variables('p', 'p_');
$text="nom: ".$p_nom.chr(10).chr(13)."Prenom:
".$p_prenom.chr(10).chr(13)."Mail: ".$p_mail.chr(10).chr(13)."Tel:
".$p_telephone.chr(10).chr(13)."Choix: ".$p_choix.chr(10).chr(13)."Message:
".$p_message.chr(10).chr(13);
$headers = 'From:'.$p_nom.'<'.$p_mail.'>'."n";
if($p_choix=="Adoptions") {
mail("", "Demande Adoptions",$text,$headers);}
if($p_choix=="Abandons") {
mail("", "Demande Abandons",$text,$headers);}
if($p_choix=="Solana") {
mail("", "Demande Infos Solana",$text,$headers);}
if($p_choix=="Autre") {
mail("", "Formulaire Solana",$text,$headers);}
header("Location:merci.htm");
?>
</body>
</html>
Avatar
CrazyCat
shmol wrote:
Oups je refais:



Toujours pareil!
Ton code doit être:
<?
import_request_variables('p', 'p_');
$text="nom: ".$p_nom.chr(10).chr(13)."Prenom:
".$p_prenom.chr(10).chr(13)."Mail: ".$p_mail.chr(10).chr(13)."Tel:
".$p_telephone.chr(10).chr(13)."Choix:
".$p_choix.chr(10).chr(13)."Message: ".$p_message.chr(10).chr(13);
$headers = 'From:'.$p_nom.'<'.$p_mail.'>'."n";
if($p_choix=="Adoptions") {
mail("", "Demande Adoptions",$text,$headers);}
if($p_choix=="Abandons") {
mail("", "Demande Abandons",$text,$headers);}
if($p_choix=="Solana") {
mail("", "Demande Infos Solana",$text,$headers);}
if($p_choix=="Autre") {
mail("", "Formulaire Solana",$text,$headers);}
header("Location:merci.htm");
?>

--
Astuces informatiques: http://www.crazycat.info
Tchattez en liberté: http://www.crazy-irc.net
Avatar
shmol
merci bien ;)


"CrazyCat" a écrit dans le message de news:
e1irhb$sn5$
shmol wrote:
Oups je refais:



Toujours pareil!
Ton code doit être:
<?
import_request_variables('p', 'p_');
$text="nom: ".$p_nom.chr(10).chr(13)."Prenom:
".$p_prenom.chr(10).chr(13)."Mail: ".$p_mail.chr(10).chr(13)."Tel:
".$p_telephone.chr(10).chr(13)."Choix:
".$p_choix.chr(10).chr(13)."Message: ".$p_message.chr(10).chr(13);
$headers = 'From:'.$p_nom.'<'.$p_mail.'>'."n";
if($p_choix=="Adoptions") {
mail("", "Demande Adoptions",$text,$headers);}
if($p_choix=="Abandons") {
mail("", "Demande Abandons",$text,$headers);}
if($p_choix=="Solana") {
mail("", "Demande Infos
Solana",$text,$headers);}
if($p_choix=="Autre") {
mail("", "Formulaire Solana",$text,$headers);}
header("Location:merci.htm");
?>

--
Astuces informatiques: http://www.crazycat.info
Tchattez en liberté: http://www.crazy-irc.net
Avatar
Thibaut Allender
On 12/04/2006 14:10, shmol wrote :
Warning: Cannot modify header information - headers already sent by (output
started at /home/httpd/vhosts/solana-asso.com/httpdocs/contact.php:5) in
/home/httpd/vhosts/solana-asso.com/httpdocs/contact.php on line 17



C'est clair, ce message dit que les headers ont déjà été envoyés à la
ligne 5, au moment où tu tentes de les redéfinir à la ligne 17, ce qui
semble logique puisque ton script envoie du code html dès le début.

Je dirais donc, RTFM : http://be.php.net/manual/fr/function.header.php :

"N'oubliez jamais que header() doit être appelée avant que le moindre
contenu ne soit envoyé, soit par des lignes HTML habituelles dans le
fichier, soit par des affichges PHP. Une erreur très classique est de
lire un fichier avec include() ou require(), et de laisser des espaces
ou des lignes vides, qui génèreront un affichage avant que la fonction
header() ne soit appelée. Le même problème existe avec les fichiers
PHP/HTML standards."

Et RTFM bis : http://giromini.org/usenet-fr/repondre.html parce que
devant le goret quotage, je craque aussi

--
thibaut allender | http://capsule.org | http://photo.capsule.org