Re bonjour![]()
Un p'tit soucis encore...
Pour la vérification d'un formulaire j'utilise le code suivant :
Je dois vérifier également que si mon select (typ) à la valeur Société ou Asso, le champ $nomsupp doit être rempli mais que si il a la valeur Particulier, pas besoin de $nomsupp et l'envoie du mal peut se faire.
Code : Sélectionner tout - Visualiser dans une fenêtre à part if((empty($nom )) || (empty($prenom )) || (empty($sujet2 )) || (empty($mess )) || (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$email)));
Alors l'écrire en français pas de soucis mais en PHP je bloque...
Mon select et le champ $nomsupp
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <select name="typ" id='one' onchange="affiche(this.selectedIndex)"> <option value="Société" <?php if (isset($_POST['typ']) and $_POST['typ'] == 'Société') {echo "selected='selected'";}?>><?php echo societe; ?></option> <option value="Association" <?php if (isset($_POST['typ']) and $_POST['typ'] == 'Association') {echo "selected='selected'";}?>><?php echo asso; ?></option> <option value="Particulier" <?php if (isset($_POST['typ']) and $_POST['typ'] == 'Particulier') {echo "selected='selected'";}?>><?php echo part; ?></option> </select> <div id="supp"<?php if (isset($_POST['typ']) and $_POST['typ'] == 'Particulier') {echo 'style="visibility:hidden;"';}?> > <label><?php echo nomsupp; ?> <span class="obl">*</span></label> <input name="nomsupp" type="text" id="nomsupp" value="<?php echo $nomsupp ; ?>" maxlength="20"> <?php if($_POST['action'] == 'submitted') { if((empty($nomsupp ))) echo $no; } ?> </div>
Partager