Bonjour,
Je fabrique un formulaire d’inscription avec l’envoi d’un mail en php mais j’ai l’erreur suivante :
Warning: Cannot modify header information - headers already sent by (output started at ..\inscription-commande.php:31)
in ..\inscription-commande.php on line 125
Les donnes sont bien enregistrees dans la bdd et le mail est bien envoyé mais la rediredirection $insertGoTo = "../inscription-a-valider.php"; ne marche pas.Si quelqu'un a une idee, je bloque
Modifié par fanny742 (30 Apr 2008 - 16:36)
Je fabrique un formulaire d’inscription avec l’envoi d’un mail en php mais j’ai l’erreur suivante :
Warning: Cannot modify header information - headers already sent by (output started at ..\inscription-commande.php:31)
in ..\inscription-commande.php on line 125
Les donnes sont bien enregistrees dans la bdd et le mail est bien envoyé mais la rediredirection $insertGoTo = "../inscription-a-valider.php"; ne marche pas.Si quelqu'un a une idee, je bloque

<?php require_once(../connexion.php'); ?>
<?php
ligne 31 if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) :
mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
...
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formulaire_inscription")) {
$insertSQL = sprintf("INSERT INTO clients (civilite, nom, prenom, adresse1, adresse2, ville, cp, tel, email, pass)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, MD5(%s))",
GetSQLValueString($_POST['civilite'], "text"),
...
mysql_select_db($database_connexion, $connexion);
$Result1 = mysql_query($insertSQL, $connexion) or die(mysql_error());
$insertGoTo = "../inscription-a-valider.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
ligne 125 header(sprintf("Location: %s", $insertGoTo));
}
?>
if($_POST){
//Récupération des données du formulaire----------------------------
$emaile = stripslashes(htmlentities($_POST["mail"]));
$motdepasse = stripslashes(htmlentities($_POST["mot_de_passe"]));
//------------------------------------------------------------------
$from = "test@hotmail.fr";
$reply = $from;
$to = $emaile;//Mettez l'email de destination ici
//Mise en forme du contenu au format HTML-----------------------
$objet = "test
$contenu = "test : ";
$contenu .= "<br /> email: ".$emaile;
$contenu .= "<br /> passe: ".$motdepasse;
$contenu .= "<br /> Message: <br />";
$contenu .= "<a href='http://../confirmation.php?email=$emaile'>cliquez ici</a>";
//--------------------------------------------------------------
//Entêtes de formatage de l'email en mode HTML------------------
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From: '.$from."\n";
$reply = $headers."Reply-to: ".$reply."\n";
//---------------------------------------------------------------
//Déclenchement de l'email et reroutage vers une autre page-----
mail($to, $objet, $contenu, $reply);
}
?>
<form action="<?php echo $editFormAction; ?>" method="POST" name="formulaire_inscription" id="formulaire_inscription"
<input name="mail" type="text" class="input" id="mail" size="30" />
...
<input name="Submit" type="image" class="bouton" id="Submit" src= />
</form>
Modifié par fanny742 (30 Apr 2008 - 16:36)