Bonjour,
J'ai développé une fiche d'inscription mais je ne sais pas comment rendre certains champs tels que (Nom, Prénom et Email) obligatoires
Comment puis je tester dans cette fiche, la non nullité de ces 3 champs ?
si ces 3 champs ne sont pas remplis, je boucle dans la fiche en forçant un focus sur le champ non saisi.
merci de votre aide.
Voici le code de ma fiche d'inscription
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115 <?php //init des variables if (!isset($HTTP_POST_VARS['BSubmit'])) $HTTP_POST_VARS['BSubmit']=""; if (!isset($erreurlog)) $erreurlog=0; if ($HTTP_POST_VARS['BSubmit']=="Envoyer") { $whbh_mail_to="gcharniere@yahoo.fr"; $whbh_mail_text = $_POST['RBMrMmeMelle'] . " " . $_POST['CNom'] . " " . $_POST['CPrenom'] . "\n" . $_POST['CAddr1'] . "\n" . $_POST['CAddr2'] . "\n" . $_POST['CCode'] . " " . $_POST['CVille'] . "\n" . $_POST['CComment'] . "\n" . "\n" . $_POST['CEmail'] . "\n" ; $whbh_mail_reply= "xxxxx@reply.com"; $whbh_mail_from="MonSite@yahoo.com"; $whbh_mail_sujet= "Demande d'inscription"; $whbh_date = date("D, j M Y H:i:s -0600"); // avec offset horaire $entetemail = "From: $whbh_mail_from \n"; // Adresse expéditeur $entetemail .= "Cc: \n"; // Carbon Copy $entetemail .= "Bcc: $whbh_mail_from \n"; // Copies cachées $entetemail .= "Reply-To: $whbh_mail_from \n"; // Adresse de retour $entetemail .= "X-Mailer: PHP/" . phpversion() . "\n" ; $entetemail .= "Date: $whbh_date"; mail($whbh_mail_to, $whbh_mail_sujet, $whbh_mail_text, $entetemail); header("Location: mainframe_accueil.php"); exit(); } ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="blstyle.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { background-image: url(Images/Nature%20Bkgrd.jpg); } --> </style></head> <body class="sub"> <form name="form1" method="post" action=""> <div align="left"></div> <table width="85%" border="0" cellpadding="8"> <tr> <td colspan="3" class="HeaderColor"> <h4 align="center"><span style="mso-bidi-font-size: 12.0pt"><span class="MF_Style_2"><font color="#007FFF" face="Comic Sans MS" size="3">Formulaire d'inscription</font></span></span></h4></td> </tr> <tr style="vertical-align: top"> <td style="text-align: right" class="Texte"> Civilité</td> <td colspan="2"> <pre class="Texte"><label for="civilite"><span class="Texte_Gras">Monsieur</span></label> <span class="Texte_Gras"><input name="RBMrMmeMelle" type="radio" id="monsieur" value="Monsieur" checked> <label for="madame"> Madame</label> <input name="RBMrMmeMelle" type="radio" id="madame" value="Madame"> <label for="mademoiselle">Mademoiselle </label> <input name="RBMrMmeMelle" type="radio" id="mademoiselle" value="Mademoiselle"> </span></pre> </td> </tr> <tr style="vertical-align: top"> <td width="23%" nowrap class="LabelColor" style="text-align: right"><label for="username" class="Texte"> Nom et Prénom </label></td> <td class="TitleColor"> <input name="CNom" type="text" class="Texte_Gras" id="IdNom" value="Nom" size="30"></td> <td class="TitleColor"> <input name="CPrenom" type="text" class="Texte_Gras" id="IdPrenom" value="Prénom" size="30"></td> </tr> <tr style="vertical-align: top"> <td style="text-align: right" class="LabelColor"><label for="addr1" class="Texte"> Adresse 1 </label></td> <td colspan="2" class="TitleColor"> <input name="CAddr1" type="text" class="Texte_Gras" id="IdAddr1" value="Adresse 1ère partie" size="70"></td> </tr> <tr style="vertical-align: top"> <td style="text-align: right" class="LabelColor"><label for="addr2" class="Texte"> Adresse 2 </label></td> <td colspan="2" class="TitleColor"> <input name="CAddr2" type="text" class="Texte_Gras" id="IdAddr2" value="Adresse 2ème partie" size="70"> </td> </tr> <tr style="vertical-align: top"> <td height="33" class="Texte" style="text-align: right"> Code Postal et Ville </td> <td width="31%" class="TitleColor"> <label for="codepostal"></label> <input name="CCode" type="text" class="Texte_Gras" id="IdCode" value="Code" size="6" maxlength="5"> </td> <td width="46%" class="TitleColor"> <label for="ville"></label> <input name="CVille" type="text" class="Texte_Gras" id="IdVille" value="Ville" size="30"> </td> </tr> <tr style="vertical-align: top"> <td height="33" class="LabelColor" style="text-align: right"><label for="email" class="Texte"> Email</label></td> <td colspan="2" class="TitleColor"> <input name="CEmail" type="text" class="Texte_Gras" id="IdEmail" value="Email" size="50"> </td> </tr> <tr style="vertical-align: top"> <td height="33" class="LabelColor" style="text-align: right"><label for="comment" class="Texte"> Observations </label></td> <td colspan="2" class="TitleColor"> <textarea name="CComment" cols="70" rows="4" wrap="VIRTUAL" class="Texte_Gras" id="IdEmail">Vos Observations</textarea> </td> </tr> <tr style="vertical-align: top"> <td colspan="3"> <pre class="Texte">Versement d'acompte : Oui <input name="RBOuiNon" type="radio" id="yes1" value="Oui" checked> N<label for="no1">on</label><input type="radio" id="no1" name="RBOuiNon" value="Non"> </pre> </td> </tr> <tr style="vertical-align: top" class="FooterColor"> <td height="36" colspan="3"><div align="center"> <input name="BSubmit" type="submit" class="Texte_Gras" id="BSubmit" value="Envoyer"> </div></td> </tr> </table> </form> </body> </html>
Partager