envoyer le résultat par e-mail
Bonjour à tous
j'ai essayé de construire en local un formulaire d'envoi d'email par la méthode suivante:
1) j'ai crée un fichier html contenant le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <div align=center>
<form method=POST action=formmail.php >
<input type=hidden name=subject value=formmail>
<table>
<tr><td>Votre Nom:</td>
<td><input type=text name=realname size=30></td></tr>
<tr><td>Votre Email:</td>
<td><input type=text name=email size=30></td></tr>
<tr><td>Sujet:</td>
<td><input type=text name=title size=30></td></tr>
<tr><td colspan=2>Commentaires:<br>
<textarea COLS=50 ROWS=6 name=comments></textarea>
</td></tr>
</table>
<br> <input type=submit value=Envoyer> -
<input type=reset value=Annuler>
</form>
</div> |
2) j'ai construis un fichier php nomé formail dont le code est
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?php
$TO = "y_derf@yahoo.fr";
$h = "From: " . $TO;
$message = "";
while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}
mail($TO, $subject, $message, $h);
Header("Location: http://localhost/merci.php");
?> |
3)j'ai construis un fichier php de reception nomé merci dont le code est :
Code:
1 2 3
| <?
echo " merci pour votre participation";
?> |
Remarque : j'ai enregistré les trois fichiers dans le répértoire www d'Easy php
j'ai essayé plusieurs fois et ça ne marche pas, j'obtient toujour le message d'erreur : The requested URL /formmail.php was not found on this server.
Merci de m'aider