Bonjour,
J'ai réussi à me bricoler un formulaire d'inscription à partir d'un "envoi mail" que j'ai récupéré, je ne m'en sort vraiment pas en Php, mon formulaire fonctionne, vu mon niveau, i'en suis fier, mon soucis, je voudrais rendre des champs obligatoires comme l'email, le téléphone ....
J'ai cherché fouillé etc.... ie n'ai rien trouvé qui puisse m'aider.
Peut-être ici, je joins mes codes
Fichier html
Fichier Php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 <form method=POST action="squelettes/formulaires/inscription.php" onSubmit="if ( email.value.length < 2 ) { alert('email obligatoire'); return false; } return true;"> <input type=hidden name=Objet value=Inscription> <table> <tr><td>Votre Nom:</td> <td><input type=text name=Nom size=30></td></tr> <tr><td>Votre prénom:</td> <td><input type=text name=Prénom size=30></td></tr> <tr><td>Votre email:</td> <td><input type=text name=email size=30></td></tr> <tr><td>Votre téléphone:</td> <td><input type=text name=Téléphone size=30></td></tr><br /> <td>{{Informations sur votre entreprise}}</td><br /> <tr><td>Entreprise:</td> <td><input type=text name=Entreprise size=30></td></tr> <tr><td>Adresse:</td> <td><input type=text name=Adresse size=30></td></tr> <tr><td>Code postal:</td> <td><input type=text name=Code postal size=30></td></tr> <tr><td>Ville:</td> <td><input type=text name=Ville size=30></td></tr> </table> <br> <input type=submit value=Envoyer> - <input type=reset value=Annuler> </form>
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 <?php $TO = "louis@monsite.net"; $h = "From: " . $TO; $message = ""; while(list($key,$value) = each($HTTP_POST_VARS)) { if(is_array($value)) { while(list($key2,$value2)=each($value)) { echo "array $key: $key2 -> $value2"; } } else { $message.= "$key : $value \n"; } } mail($TO, $subject, $message, $h); Header("Location: http://www.monsite.fr/merci.html"); ?>
Partager