ENVOYÉ UN FORMULAIRE AVEC PHP

Fermé
GEN - 5 oct. 2009 à 05:07
karikikou Messages postés 84 Date d'inscription dimanche 7 décembre 2008 Statut Membre Dernière intervention 6 juillet 2011 - 5 oct. 2009 à 10:39
Bonjour,

je veux que mon formulaire me soit enoyé sans que le client ait a passer par outlook, on m'a conseillé d'utiliser le php, c'est la premiere fois que je l'utilise et évidemment ça ne fonctionne pas.. quelqu'un peut m'aider..

voici le formulaire en question :

<html>
<title> Book Online</title>
<head>

<body>
<FONT COLOR="#09380f">
<FONT FACE="century gothic">
<h1 align=center><img src=BOOK.jpg> </h1>


<h2 align=center>
Reservations <br> </h2>

<h4 align=center>Please fill this form and press submit to receive informations on rooms availability</h4>
<TABLE BORDER=0; align=center>
<form method="POST" enctype="text/plain" action="emailform.php">
<div align="center"></div>
<p align="center">
<table width="566" border="0" align="center">
<p align="center">
</p><tr>
<td><font face="century gothic" size="2">Full name </font></td>
<td><input name="NAME" type="text"></td>
</tr><tr>

<td><font face="century gothic" size="2">Adress</font></td>
<td><input name="ADRESS" type="text"></td>
</tr><tr>
<td><font face="century gothic" size="2">City</font></td>
<td><input name="CITY" type="text"></td>
</tr><tr>
<td><font face="century gothic" size="2">State / province</font></td>

<td><input name="STATE_PROVINCE" type="text"></td>
</tr><tr>
<td><font face="century gothic" size="2">Zip postal code</font></td>
<td><input name="POSTAL" type="text"></td>
</tr><tr>
<td><font face="century gothic" size="2">Country</font></td>
<td><input name="COUNTRY" type="text"></td>
</tr><tr>

<td><font face="century gothic" size="2">Phone</font></td>
<td><input name="PHONE" type="text"></td>
</tr><tr>
<td><font face="century gothic" size="2">Arrival date</font></td>
<td><input name="ARRIVAL" type="text"></td>
</tr><tr>
<td><font face="century gothic" size="2">Departure date</font></td>

<td><input name="DEPARTURE" type="text"></td>
</tr><tr>
<td><font face="century gothic" size="2">Number of guests</font></td>
<td><input name="GUESTS" type="text"></td>
</tr><tr>
<td width><font face="century gothic" size="2">Contact E-mail</font></td>
<td width><input name="EMAIL" type="text"></td>
</tr><tr>

<td valign="top"><font face="century gothic" size="2">Comments / questions</font></td>
<td><textarea name="COMMENTS" cols="50" rows="10"></textarea></td>
</tr><tr>
</td>
<td>
<input type="reset" name="Reset" value="Erase"align="center">

<input align="center" type="submit" value="Submit">
</div></td>
</tr>
</table>
<div align="center"></div>
</form>

<h3 align=center><A HREF="index.html"><FONT COLOR="#09380f">Return to main page</FONT></a></h3>


</body>

</html>

et voici mon emailform.php

<html>
?php
$msg .= "NAME:\t$sender_NAME\n";
$msg .= "ADRESS:\t$sender_ADRESS\n";
$msg .= "CITY:\t$sender_CITY\n";
$msg .= "STATE_PROVINCE:\t$sender_PROVINCE\n";
$msg .= "POSTAL CODE:\t$sender_POSTAL\n";
$msg .= "COUNTRY:\t$sender_COUNTRY\n";
$msg .= "PHONE:\t$sender_PHONE\n";
$msg .= "ARRIVAL DATE:\t$ARRIVAL\n";
$msg .= "DEPARTURE DATE:\t$sender_DEPARTURE\n";
$msg .= "NUMBER OF GUESTS:\t$sender_GUESTS\n";
$msg .= "EMAIL:\t$sender_EMAIL\n\n";
$msg .= "COMMENTS:\t$sender_COMMENTS\n\n";

$recipient = "petite_geny@hotmail.com";
$subject = "RESERVATION ONLINE";

$mailheaders = "From: MANDALA APPART'HOTEL WEBSITE <> \n";
$mailheaders .= "Reply-To: $sender_mail\n\n";

mail($recipient, $subject, $msg, $mailheaders);

echo "<HTML><HEAD>";
echo "<TITLE>Tanks for your reservation</TITLE></HEAD><BODY>";
echo "<H1 align=center>Tanks, $sender_nom $sender_prenom</H1>";
echo "<P align=center>";
echo "WE'LL COMMUNICATE WITH YOU AS SOON AS POSSIBLE ! </P>";
echo "</BODY></HTML>";



?>

merci d'avance

1 réponse

karikikou Messages postés 84 Date d'inscription dimanche 7 décembre 2008 Statut Membre Dernière intervention 6 juillet 2011 1
5 oct. 2009 à 10:39
Salut

Utilise la formule Mail () comme ci dessous. Tu le met juste avant ton formulaire



<?php
if ($_POST['submit-form'] == 'ok')
{

$to = xxxxxxx@gmail.com;

$subject = 'nouvelle inscription surxxxxx;
$message = "Veuillez trouver ci dessous un recapitulatif de votre inscription sur ......."."\n\nChamp1 : ".$_POST['champ1']."\n\nChamp2: ".$_POST['champ2']."\n\nVous êtes: ".$_POST['sexe']."\n\nContact : ".$_POST['contact']."\n\nTéléphone : ".$_POST['Tel']."\n\nFax: ".$_POST['fax']."\n\nE-mail : ".$_POST['email']."\n\nDemande : ".$_POST['souhait']."\n\nPréférence de contact: ".$_POST['moyen']."\n\nType : ".$_POST['type']."\n\nCommentaires : ".$_POST['Commentaire']."\n\n\nN'hésitez pas a venir souvent sur notre site"."\n\nCordialement"."\n\nL'équipe de xxxxxxxxxxx";
$headers = 'From: xxxxxxxx@xxxxxxx.com' . "\r\n" .
'Reply-To: xxxxxx@xxxxxxxx.com ' . "\r\n" .
'X-Mailer: PHP/' . phpversion();


mail($to, $subject, $message, $headers);


}
else { ?>

Ensuite tu mets ton form
<form>
</form>

<? php } >


Et voila tu configure comem tu veux avec tes propres champs

J'espère que ca va t'aider

A +
0