par
PolyC » 31 janv. 2011, 14:36
Bonjour,
Je cherche a faire un formulaire d'adhésion à une association qui lorsqu'on a fini de remplir les champs, cela envoie un mail à une boite bien précise pour récupérer les informations. Pour ce faire j'ai deux fichiers:
index.html
<form action="mail.php" method="post" name="formulaire">
<h3>Informations Personnelles</h3><br /><br />
Nom: <input id="nom" name="nom" type="text" maxlength="255" value=""/> <br />
Prenom: <input id="prenom" name="prenom" type="text" maxlength="255" value=""/> <br />
Date de Naissance: <input id="naissance" name="naissance" type="text" maxlength="255" value=""/> <br />
<h3>Coordonnes</h3><br /><br />
Email: <input id="email" name="email" type="text" maxlength="255" value=""/> <br />
Ville: <input id="ville" name="ville" type="text" maxlength="255" value=""/> <br />
Adresse: <input id="adresse" name="adresse" type="text" maxlength="255" value=""/> <br />
Code Postale: <input id="postale" name="postale" type="text" maxlength="255" value=""/> <br />
N° Fixe: <input id="fixe" name="fixe" type="text" maxlength="255" value=""/> <br />
N° Portable: <input id="portable" name="portable" type="text" maxlength="255" value=""/> <br />
<h3>Informations Complémentaires</h3><br /><br />
Nom de votre établissement scolaire: <input id="scolaire" name="scolaire" type="text" maxlength="255" value=""/> <br />
Moyen de payement: <select id="payement" name="payement">
<option value="paypal" selected="selected">Paypal</option>
<option value="cheque" >Cheque</option
></select>
<br />
<input type="submit" name="valider" value="Valider" />
</form>
et
mail.php
<?php
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$email = $_POST['email'];
$ville = $_POST['ville'];
$adresse = $_POST['adresse'];
$postale = $_POST['postale'];
$fixe = $_POST['fixe'];
$portable = $_POST['portable'];
$to = '[email protected]';
$sujet ='ADHESION RVL';
$msg="Email d'adhesion/readhesion a Radio VL:\n
Nom: $nom \n
Prenom: $prenom \n
Email: $email \n
Ville: $ville \n
Adresse: $adresse \n
Code Postale: $postale \n
Telephone Fixe: $fixe \n
Telephone Portable: $portable \n";
/* En-têtes de l'e-mail */
$headers = 'From: '.$nom.' <'.$email.'>'."\r\n\r\n";
/* Envoi de l'e-mail */
mail($to, $sujet, $msg, $headers);
?>
Cependant mon script ne fonctionne pas, pourriez-vous m'aider en me disant ou sont mes erreurs.
Merci d'avance,
Cordialement Cyprien
Bonjour,
Je cherche a faire un formulaire d'adhésion à une association qui lorsqu'on a fini de remplir les champs, cela envoie un mail à une boite bien précise pour récupérer les informations. Pour ce faire j'ai deux fichiers:
[b]index.html[/b]
[html]
<form action="mail.php" method="post" name="formulaire">
<h3>Informations Personnelles</h3><br /><br />
Nom: <input id="nom" name="nom" type="text" maxlength="255" value=""/> <br />
Prenom: <input id="prenom" name="prenom" type="text" maxlength="255" value=""/> <br />
Date de Naissance: <input id="naissance" name="naissance" type="text" maxlength="255" value=""/> <br />
<h3>Coordonnes</h3><br /><br />
Email: <input id="email" name="email" type="text" maxlength="255" value=""/> <br />
Ville: <input id="ville" name="ville" type="text" maxlength="255" value=""/> <br />
Adresse: <input id="adresse" name="adresse" type="text" maxlength="255" value=""/> <br />
Code Postale: <input id="postale" name="postale" type="text" maxlength="255" value=""/> <br />
N° Fixe: <input id="fixe" name="fixe" type="text" maxlength="255" value=""/> <br />
N° Portable: <input id="portable" name="portable" type="text" maxlength="255" value=""/> <br />
<h3>Informations Complémentaires</h3><br /><br />
Nom de votre établissement scolaire: <input id="scolaire" name="scolaire" type="text" maxlength="255" value=""/> <br />
Moyen de payement: <select id="payement" name="payement">
<option value="paypal" selected="selected">Paypal</option>
<option value="cheque" >Cheque</option
></select>
<br />
<input type="submit" name="valider" value="Valider" />
</form>
[/html]
et [b]mail.php[/b]
[php]
<?php
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$email = $_POST['email'];
$ville = $_POST['ville'];
$adresse = $_POST['adresse'];
$postale = $_POST['postale'];
$fixe = $_POST['fixe'];
$portable = $_POST['portable'];
$to = '
[email protected]';
$sujet ='ADHESION RVL';
$msg="Email d'adhesion/readhesion a Radio VL:\n
Nom: $nom \n
Prenom: $prenom \n
Email: $email \n
Ville: $ville \n
Adresse: $adresse \n
Code Postale: $postale \n
Telephone Fixe: $fixe \n
Telephone Portable: $portable \n";
/* En-têtes de l'e-mail */
$headers = 'From: '.$nom.' <'.$email.'>'."\r\n\r\n";
/* Envoi de l'e-mail */
mail($to, $sujet, $msg, $headers);
?>
[/php]
Cependant mon script ne fonctionne pas, pourriez-vous m'aider en me disant ou sont mes erreurs.
Merci d'avance,
Cordialement Cyprien