Envoie d'un formulaire en utilisant WYSIWYG

Fermé
pipo1435 Messages postés 4 Date d'inscription dimanche 25 octobre 2009 Statut Membre Dernière intervention 7 novembre 2009 - 25 oct. 2009 à 20:31
Nico_ Messages postés 1219 Date d'inscription vendredi 29 décembre 2006 Statut Membre Dernière intervention 15 mars 2016 - 26 oct. 2009 à 09:17
Bonjour,

Après de nombreuses recherches je n'arrive pas à résoudre mon problème. Je crée un site avec WYSIWYG Web Builder, et j'ai crée un formulaire de contact que je souhaite, lorsque les gens clique sur le bouton 'envoyé', envoyer sur mon adresse e-mail. Ce logiciel permet d'utiliser "un générateur de forme PHP intégré pour envoyer les données à un courriel" , mais lorsque que j'active cette option, et que je test l'envoi, je ne reçois rien sur mon e-mail, et la page affiche une page blanche avec écrit :

"Warning: Cannot modify header information - headers already sent by (output started at /data/nfs/ftp/00/45/98/root/contact.php:3) in /data/nfs/ftp/00/45/98/root/contact.php on line 80"

Dans les options du formulaire, je peux aussi cocher une case qui dit : "écrire les données dans un fichier.csv"
et je peux également cocher une dernière case : "charger les fichiers dans un dossier sur le serveur"

Je n'es pas cocher ces deux cases étant donné que je ne sais pas à quoi elles servent.

Dans "action" il est écrit : <?php echo basename(__FILE__); ?>
Méthode : post
Type d'encodage : multipart/form-data

Comment résoudre mon problème ? Merci d'avance à tous.
A voir également:

3 réponses

Nico_ Messages postés 1219 Date d'inscription vendredi 29 décembre 2006 Statut Membre Dernière intervention 15 mars 2016 189
25 oct. 2009 à 20:50
bonsoir,

tu as un problème de code avec la page contact.php à la ligne 80 ou avant

quelle est le code source de cette page ?

bonne soirée
0
pipo1435 Messages postés 4 Date d'inscription dimanche 25 octobre 2009 Statut Membre Dernière intervention 7 novembre 2009
25 oct. 2009 à 21:29
Voila le code source de la page du formulaire, désolé c'est un peu long, merci.

<?php
function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}

if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mailto = 'pipo_nipeek@hotmail.fr';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'test';
$message = 'test';
$success_url = './Message_envoyé.php';
$error_url = '';
$error = '';
$eol = "\n";
$max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000;
$boundary = md5(uniqid(time()));

$header = 'From: '.$mailfrom.$eol;
$header .= 'Reply-To: '.$mailfrom.$eol;
$header .= 'MIME-Version: 1.0'.$eol;
$header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
$header .= 'X-Mailer: PHP v'.phpversion().$eol;
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}

if (!empty($error))
{
$errorcode = file_get_contents($error_url);
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode);
echo $errorcode;
exit;
}

$internalfields = array ("submit", "reset", "send", "captcha_code");
$message .= $eol;
foreach ($_POST as $key => $value)
{
if (!in_array(strtolower($key), $internalfields))
{
if (!is_array($value))
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol;
}
else
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol;
}
}
}

$body = 'This is a multi-part message in MIME format.'.$eol.$eol;
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: text/plain; charset=iso-8859-1'.$eol;
$body .= 'Content-Transfer-Encoding: 8bit'.$eol;
$body .= $eol.stripslashes($message).$eol;
if (!empty($_FILES))
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0 && $_FILES[$key]['size'] <= $max_filesize)
{
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol;
$body .= 'Content-Transfer-Encoding: base64'.$eol;
$body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol;
$body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol;
}
}
}
$body .= '--'.$boundary.'--'.$eol;
mail($mailto, $subject, $body, $header);
header('Location: '.$success_url);
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="fr">
<title>NIPEEK - CONTACT</title>



div#container
{
width: 1000px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
body
{
text-align: center;
margin: 0;
}
</style>
<script language="JavaScript" type="text/javascript">
<!--
function Validatecontact(theForm)
{
var strValue = theForm.Editbox6.value;
var strFilter = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (!strFilter.test(strValue))
{
alert("Votre e-mail n'est pas correcte");
theForm.Editbox6.focus();
return false;
}
return true;
}
//-->
</script>
<script type="text/javascript">
<!--
function SwapImage()
{
var doc=document, args=arguments;
doc.$imgSwaps = new Array();
for(var i=2; i<args.length; i+=2)
{
var elem=FindObject(args[i]);
if(elem)
{
doc.$imgSwaps[doc.$imgSwaps.length]=elem;
elem.$src=elem.src;
elem.src=args[i+1];
}
}
}
// -->
</script>
<script type="text/javascript">
<!--
function PreloadImages()
{
var imageObj = new Image();
var images = new Array();
images[0]="./images/img0003.gif";
images[1]="./images/img0003_over.gif";
images[2]="./images/img0007.gif";
images[3]="./images/img0007_over.gif";
images[4]="./images/img0008.gif";
images[5]="./images/img0008_over.gif";
images[6]="./images/img0009.gif";
images[7]="./images/img0009_over.gif";
images[8]="./images/img0010.gif";
images[9]="./images/img0010_over.gif";
images[10]="./images/img0055.gif";
images[11]="./images/img0055_over.gif";
images[12]="./images/img0056.gif";
images[13]="./images/img0056_over.gif";
images[14]="./images/img0057.gif";
images[15]="./images/img0057_over.gif";
images[16]="./images/img0058.gif";
images[17]="./images/img0058_over.gif";
images[18]="./images/img0059.gif";
images[19]="./images/img0059_over.gif";
for (var i=0; i<=19; i++)
{
imageObj.src = images[i];
}
}
// -->
</script>
<script type="text/javascript">
<!--
function FindObject(id, doc)
{
var child, elem;
if(!doc)
doc=document;
if(doc.getElementById)
elem=doc.getElementById(id);
else
if(doc.layers)
child=doc.layers;
else
if(doc.all)
elem=doc.all[id];
if(elem)
return elem;
if(doc.id==id || doc.name==id)
return doc;
if(doc.childNodes)
child=doc.childNodes;
if(child)
{
for(var i=0; i<child.length; i++)
{
elem=FindObject(id,child[i]);
if(elem)
return elem;
}
}
var frm=doc.forms;
if(frm)
{
for(var i=0; i<frm.length; i++)
{
var elems=frm[i].elements;
for(var j=0; j<elems.length; j++)
{
elem=FindObject(id,elems[i]);
if(elem) return elem;
}
}
}
return null;
}
// -->
</script>
<style type="text/css">
a
{
color: #FFFFE0;
}
a:active
{
color: #7FFFD4;
}
a:hover
{
color: #C0FFFF;
}
</style>
</head>
<body bgcolor="#000000" text="#000000">
<div id="container">
<div id="wb_Form2" style="position:absolute;left:143px;top:247px;width:708px;height:306px;z-index:11;" align="left">
<form name="contact" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="Form2" onsubmit="return Validatecontact(this)">
<input type="text" id="Editbox6" style="position:absolute;left:78px;top:140px;width:200px;background-color:#000000;color:#FFFFFF;font-family:High Tower Text;font-size:16px;z-index:0" name="e-mail" value="">
<input type="text" id="Editbox5" style="position:absolute;left:78px;top:90px;width:200px;background-color:#000000;color:#FFFFFF;font-family:High Tower Text;font-size:16px;z-index:1" name="Prénom" value="">
<input type="reset" id="Button2" name="Réinitialisé" value="Réinitialisé" style="position:absolute;left:349px;top:252px;width:96px;height:25px;background-color:#98FB98;font-family:High Tower Text;font-size:16px;z-index:2">
<input type="submit" id="Button1" name="Envoyer" value="Envoyer" style="position:absolute;left:225px;top:252px;width:96px;height:25px;background-color:#98FB98;font-family:High Tower Text;font-size:16px;z-index:3">
<select name="Statut" size="1" id="Combobox2" style="position:absolute;left:77px;top:196px;width:203px;background-color:#000000;color:#98FB98;font-family:High Tower Text;font-size:16px;z-index:4">
<option selected value="select">Choisissez votre statut</option>
<option>Etudiant(e)</option>
<option>Employé(e)</option>
<option>Autres</option>
</select>
<div id="wb_Text1" style="position:absolute;left:342px;top:31px;width:72px;height:42px;z-index:5;" align="left">
<font style="font-size:11px" color="#000000" face="Arial">Double click to edit</font><font style="font-size:11px" color="#98FB98" face="Arial">Message</font></div>
<div id="wb_Text5" style="position:absolute;left:19px;top:71px;width:57px;height:42px;z-index:6;" align="left">
<font style="font-size:11px" color="#000000" face="Arial">Double click to edit</font><font style="font-size:11px" color="#98FB98" face="Arial">Prénom</font></div>
<div id="wb_Text6" style="position:absolute;left:27px;top:119px;width:46px;height:56px;z-index:7;" align="left">
<font style="font-size:11px" color="#000000" face="Arial">Double click to edit</font><font style="font-size:11px" color="#98FB98" face="Arial">E-mail</font></div>
<input type="text" id="Editbox1" style="position:absolute;left:78px;top:43px;width:200px;background-color:#000000;color:#FFFFFF;font-family:High Tower Text;font-size:16px;z-index:8" name="Nom" value="">
<div id="wb_Text4" style="position:absolute;left:34px;top:21px;width:48px;height:42px;z-index:9;" align="left">
<font style="font-size:11px" color="#000000" face="Arial">Double click to edit</font><font style="font-size:11px" color="#98FB98" face="Arial">Nom</font></div>
<textarea name="Message" id="TextArea1" style="position:absolute;left:408px;top:43px;width:279px;height:178px;background-color:#000000;color:#FFFFFF;font-family:High Tower Text;font-size:16px;z-index:10" rows="8" cols="34"></textarea>
</form>
</div>
<div id="wb_Text7" style="position:absolute;left:130px;top:559px;width:695px;height:28px;z-index:12;" align="center">
<font style="font-size:11px" color="#FFFFFF" face="Arial">           Conformément à l'Art. 34 de la Loi française " informatique et libertés ", Vous disposez d'un droit d'accès, de modification, de rectification et de suppression des données qui vous concernent . Pour exercer ce droit, adressez-vous à : Contact@nipeek.com .</font></div>
<div id="wb_Image2" style="position:absolute;left:271px;top:60px;width:446px;height:138px;z-index:13;" align="left">
<img src="images/nipeek.bmp" id="Image2" alt="" align="top" border="0" style="width:446px;height:138px;"></div>
<div id="wb_Image1" style="position:absolute;left:14px;top:149px;width:135px;height:409px;z-index:14;" align="left">
<img src="images/img0034.jpg" id="Image1" alt="" align="top" border="0" style="width:135px;height:409px;"></div>
<div id="wb_Image3" style="position:absolute;left:835px;top:149px;width:135px;height:409px;z-index:15;" align="left">
<img src="images/barre menu.bmp" id="Image3" alt="" align="top" border="0" style="width:135px;height:409px;"></div>
<div id="wb_NavigationBar2" style="position:absolute;left:149px;top:216px;width:686px;height:22px;z-index:16;" align="left">
<table border="0" cellpadding="0" cellspacing="0" id="NavigationBar2">
<tr>
<td align="left" valign="top" width="134" height="22"><a href="./index.html" target="_self"><img id="img0003" src="images/img0003.gif" alt="" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0003','images/img0003_over.gif')" onmouseout="SwapImage(0,0,'img0003','images/img0003.gif')"></a></td>
<td width="4"></td><td align="left" valign="top" width="134" height="22"><a href="./collections.html"><img id="img0007" src="images/img0007.gif" alt="" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0007','images/img0007_over.gif')" onmouseout="SwapImage(0,0,'img0007','images/img0007.gif')"></a></td>
<td width="4"></td><td align="left" valign="top" width="134" height="22"><a href="./contact.php"><img id="img0008" src="images/img0008.gif" alt="" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0008','images/img0008_over.gif')" onmouseout="SwapImage(0,0,'img0008','images/img0008.gif')"></a></td>
<td width="4"></td><td align="left" valign="top" width="134" height="22"><a href="./goodies.html"><img id="img0009" src="images/img0009.gif" alt="" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0009','images/img0009_over.gif')" onmouseout="SwapImage(0,0,'img0009','images/img0009.gif')"></a></td>
<td width="4"></td><td align="left" valign="top" width="134" height="22"><a href="./casting.html"><img id="img0010" src="images/img0010.gif" alt="Casting" title="Casting" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0010','images/img0010_over.gif')" onmouseout="SwapImage(0,0,'img0010','images/img0010.gif')"></a></td>
</tr>
</table>
</div>
<div id="wb_Image4" style="position:absolute;left:271px;top:60px;width:446px;height:138px;z-index:17;" align="left">
<img src="images/nipeek.bmp" id="Image4" alt="" align="top" border="0" style="width:446px;height:138px;"></div>
<div id="wb_NavigationBar3" style="position:absolute;left:149px;top:216px;width:686px;height:22px;z-index:18;" align="left">
<table border="0" cellpadding="0" cellspacing="0" id="NavigationBar3">
<tr>
<td align="left" valign="top" width="134" height="22"><a href="./index.html" target="_self"><img id="img0055" src="images/img0055.gif" alt="" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0055','images/img0055_over.gif')" onmouseout="SwapImage(0,0,'img0055','images/img0055.gif')"></a></td>
<td width="4"></td><td align="left" valign="top" width="134" height="22"><a href="./collections.html"><img id="img0056" src="images/img0056.gif" alt="" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0056','images/img0056_over.gif')" onmouseout="SwapImage(0,0,'img0056','images/img0056.gif')"></a></td>
<td width="4"></td><td align="left" valign="top" width="134" height="22"><a href="./contact.php"><img id="img0057" src="images/img0057.gif" alt="" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0057','images/img0057_over.gif')" onmouseout="SwapImage(0,0,'img0057','images/img0057.gif')"></a></td>
<td width="4"></td><td align="left" valign="top" width="134" height="22"><a href="./goodies.html"><img id="img0058" src="images/img0058.gif" alt="" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0058','images/img0058_over.gif')" onmouseout="SwapImage(0,0,'img0058','images/img0058.gif')"></a></td>
<td width="4"></td><td align="left" valign="top" width="134" height="22"><a href="./casting.html"><img id="img0059" src="images/img0059.gif" alt="Casting" title="Casting" align="top" border="0" width="134" height="22" onmouseover="SwapImage(1,0,'img0059','images/img0059_over.gif')" onmouseout="SwapImage(0,0,'img0059','images/img0059.gif')"></a></td>
</tr>
</table>
</div>
<div id="wb_Image5" style="position:absolute;left:835px;top:148px;width:135px;height:409px;z-index:19;" align="left">
<img src="images/barre menu.bmp" id="Image5" alt="" align="top" border="0" style="width:135px;height:409px;"></div>
<div id="wb_Image6" style="position:absolute;left:14px;top:149px;width:135px;height:409px;z-index:20;" align="left">
<img src="images/img0060.jpg" id="Image6" alt="" align="top" border="0" style="width:135px;height:409px;"></div>
</div>
</body>
</html>
0
pipo1435 Messages postés 4 Date d'inscription dimanche 25 octobre 2009 Statut Membre Dernière intervention 7 novembre 2009
25 oct. 2009 à 22:01
j'ai rééssayé, et maintenant le formulaire est bien envoyé sur mon adresse email, cependant la page blanche avec ecrit :

"Warning: Cannot modify header information - headers already sent by (output started at /data/nfs/ftp/00/45/98/root/contact.php:3) in /data/nfs/ftp/00/45/98/root/contact.php on line 80"

est toujours là, normalement ma page doit être redirigé vers une page de remerciement... comment faire ? ligne 80 il doit y avoir qqch à changer ? mais quoi...
0
Nico_ Messages postés 1219 Date d'inscription vendredi 29 décembre 2006 Statut Membre Dernière intervention 15 mars 2016 189
26 oct. 2009 à 09:17
bonjour,

ton code:
$body .= '--'.$boundary.'--'.$eol;
mail($mailto, $subject, $body, $header);
header('Location: '.$success_url);
exit; 
rajoute () à la fin de exit --> exit();
$body .= '--'.$boundary.'--'.$eol;
mail($mailto, $subject, $body, $header);
header('Location: '.$success_url);
exit(); 
0