PB envoi formulaire via php formail
Consti
-
tarik -
tarik -
Bonjour,
J'ai un formulaire de contact dont je veux envoyer les données sur mon mail via une page "formmail.php"
Lorsque je teste mon formulaire en local, je reçois bien un e-mail dans ma boîte, mais il est vide!!!!
Là j'ai mis mon site en ligne, www.multimedia-infographiste.fr (si vous pouvez jeter un oeil) et lorsqu'on valide la formulaire, il y a un message d'erreur.
Je ne comprend pas d'où vient le souci!!
J'espère que vous pourrez m'aider..je vous donne mes codes :
Merci pour votre aide!
//////////////PAGE formmail.php////////////////////////
<?php
$TO = "monmail@mail.fr";
$h = "From: " . $TO;
$message = "";
while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}
mail($TO, $subject, $message, $h);
Header("Location: ../HTML/merci.html");
?>
/////////////////////page contact.html//////////////////////
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans nom</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="../php/formmail.php">
<input type="hidden" name="subject" value="Contact">
<label><input type="radio" name="civilite" value="melle" id="civilite_0" checked />Mademoiselle</label>
<label><input type="radio" name="civilite" value="mme" id="civilite_1" />Madame</label>
<label><input type="radio" name="civilite" value="Mr" id="civilite_2" />Monsieur</label>
<br /><br />
<span class="text"><label for="nom">Nom:</label><input type="text" name="nom" id="nom" /><br /><br />
<label for="prenom">Prénom:</label><input type="text" name="prenom" id="prenom" /><br /><br />
<label for="mail">E-mail : </label><input type="text" name="mail" id="mail" /><br /><br />
<label for="telephone">Téléphone:</label><input type="text" name="telephone" id="telephone" /></span><br /><br />
<br />
<textarea name="message" id="message" cols="80" rows="15" >Votre message....</textarea>
<br /><br />
<span class="submit"><input name="id_contact" type="submit" value="Valider" /></span>
</form>
</body>
</html>
J'ai un formulaire de contact dont je veux envoyer les données sur mon mail via une page "formmail.php"
Lorsque je teste mon formulaire en local, je reçois bien un e-mail dans ma boîte, mais il est vide!!!!
Là j'ai mis mon site en ligne, www.multimedia-infographiste.fr (si vous pouvez jeter un oeil) et lorsqu'on valide la formulaire, il y a un message d'erreur.
Je ne comprend pas d'où vient le souci!!
J'espère que vous pourrez m'aider..je vous donne mes codes :
Merci pour votre aide!
//////////////PAGE formmail.php////////////////////////
<?php
$TO = "monmail@mail.fr";
$h = "From: " . $TO;
$message = "";
while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}
mail($TO, $subject, $message, $h);
Header("Location: ../HTML/merci.html");
?>
/////////////////////page contact.html//////////////////////
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans nom</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="../php/formmail.php">
<input type="hidden" name="subject" value="Contact">
<label><input type="radio" name="civilite" value="melle" id="civilite_0" checked />Mademoiselle</label>
<label><input type="radio" name="civilite" value="mme" id="civilite_1" />Madame</label>
<label><input type="radio" name="civilite" value="Mr" id="civilite_2" />Monsieur</label>
<br /><br />
<span class="text"><label for="nom">Nom:</label><input type="text" name="nom" id="nom" /><br /><br />
<label for="prenom">Prénom:</label><input type="text" name="prenom" id="prenom" /><br /><br />
<label for="mail">E-mail : </label><input type="text" name="mail" id="mail" /><br /><br />
<label for="telephone">Téléphone:</label><input type="text" name="telephone" id="telephone" /></span><br /><br />
<br />
<textarea name="message" id="message" cols="80" rows="15" >Votre message....</textarea>
<br /><br />
<span class="submit"><input name="id_contact" type="submit" value="Valider" /></span>
</form>
</body>
</html>
A voir également:
- PB envoi formulaire via php formail
- Whatsapp formulaire opposition - Guide
- Formulaire de réclamation facebook compte désactivé - Guide
- Confirmer le nouvel envoi du formulaire err_cache_miss ✓ - Forum HTML
- Formulaire de reclamation instagram - Guide
- Easy php - Télécharger - Divers Web & Internet
1 réponse
bonjour,
je vois que le problème viens de la fonction mail() ,tu a cette erreur :
/php/formmail.php on line 14
qui viens peut être de ton sujet ? les fonctions mail n'aime pas envoyer de mail sans sujet.
après il te reste ces erreurs ,faut que tu regarde a quoi correspondent les lignes ,
Warning: Cannot modify header information - headers already sent by (output started at /homez.370/multimeds/www/php/formmail.php:3) in /homez.370/multimeds/www/php/formmail.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at /homez.370/multimeds/www/php/formmail.php:3) in /homez.370/multimeds/www/php/formmail.php on line 39
je vois que le problème viens de la fonction mail() ,tu a cette erreur :
/php/formmail.php on line 14
qui viens peut être de ton sujet ? les fonctions mail n'aime pas envoyer de mail sans sujet.
après il te reste ces erreurs ,faut que tu regarde a quoi correspondent les lignes ,
Warning: Cannot modify header information - headers already sent by (output started at /homez.370/multimeds/www/php/formmail.php:3) in /homez.370/multimeds/www/php/formmail.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at /homez.370/multimeds/www/php/formmail.php:3) in /homez.370/multimeds/www/php/formmail.php on line 39
j'ai utilisé un script php trouvé sur un forum et les utilisateurs disent qu'il fonctionne tres bien.
peut etre qu'il faut quand même y ajouter des paramètrages? j'ai modifié l'adresse mail et la redirection vers une page de remerciement, c'est tout. y a -t-il une histoire de variables à modifier ou à ajouter en fonction de mon formulaire html?
en tapant les messages d'erreur dans google je n'ai aucun résultat!!
Concernant les messages d'erreur suivants :
Warning: Cannot modify header information - headers already sent by (output started at /homez.370/multimeds/www/php/formmail.php:3) in /homez.370/multimeds/www/php/formmail.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at /homez.370/multimeds/www/php/formmail.php:3) in /homez.370/multimeds/www/php/formmail.php on line 39
Tu effectues un envoi de données au navigateur AVANT d'utiliser la fonction PHP header()
Il NE faut PAS faire de sortie au navigateur AVANT d'utiliser cette fonction, pour ça je te renvoie à la doc officielle PHP conçue dans cet esprit https://www.php.net/manual/fr/function.header.php
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form_tab">
<tr>
<td width="170"><h2>Coordonnées</h2></td>
<td> </td>
</tr>
<tr>
<td>Vous êtes*</td>
<td><select name="structure" id="structure" onchange="showRaison(this.options.selectedIndex);">
<option value="0">Choisissez</option>
<option value="1">Société</option>
<option value="2">Association</option>
<option value="3">Profession libérale</option>
<option value="4">Particulier</option>
<option value="5">Etudiant</option>
<option value="6">Autre</option>
</select></td>
</tr>
<tr id="tr_raison" style="display:none">
<td id="td_raison"></td>
<td><input type="text" name="raison" id="raison" class="input" maxlength="50" size="40" value="" /></td>
</tr>
<tr>
<td>Civilité*</td>
<td><input type="radio" name="civilite" id="civilite_1" value="1" /><label for="civilite_1">Mlle</label> <input type="radio" name="civilite" id="civilite_2" value="2" /><label for="civilite_2">Mme</label> <input type="radio" name="civilite" id="civilite_3" value="3" /><label for="civilite_3">M.</label> </td>
</tr>
<tr>
<td>Nom*</td>
<td><input type="text" name="nom" id="nom" class="input" maxlength="50" size="40" value="" /></td>
</tr>
<tr>
<td>Prénom</td>
<td><input type="text" name="prenom" id="prenom" class="input" maxlength="50" size="40" value="" /></td>
</tr>
<tr>
<td>Téléphone*</td>
<td><input type="text" name="tel" id="tel" class="input" maxlength="20" size="20" onkeypress="return checkNum(event);" value="" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" id="email" class="input" maxlength="100" size="40" value="" /></td>
</tr>
<tr>
<td><h2>Votre demande</h2></td>
<td> </td>
</tr>
<tr>
<td>Message*</td>
<td><textarea name="ch_1" id="ch_1" class="input" cols="50" rows="8"></textarea></td>
</tr>
<tr>
<td style="font-size:9px;">* champs obligatoires</td>
<td><input type="submit" name="submit" id="submit" value="Valider" /></td>
</tr>
</table>