Bonjour.
Afin de pouvoir afficher le contenu du checkbox et sans être obligé de l'écrire deux fois comment je devrais écrire mon input?
Le choix sont des phrases mais je vais juste mettre des lettres :
a oui
b oui
c
En principe, ce que je devrais recevoir par courriel, serait juste a et b.
L'erreur si je ne coche pas une option puisque ce n'est pas obligatoire :
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 <?php if (isset($_POST['envoye'])){ $op_a = $_POST['op_a']; $op_b = $_POST['op_b']; $op_c = $_POST['op_c']; echo $op_a.'<br>'; echo $op_b.'<br>'; echo $op_c.'<br>'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="fr"> <head> <title>Nous contacter</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <input type="checkbox" name="op_a" id="op_a" value="a" /> <label for="op_a">a</label><br /> <input type="checkbox" name="op_b" id="op_b" value="b" /> <label for="op_b">b</label><br /> <input type="checkbox" name="op_c" id="op_c" value="c" /> <label for="op_c">c</label><br /> <input type="submit" name="envoye" value="Envoyer" /> </form> </body> </html>
Code : Sélectionner tout - Visualiser dans une fenêtre à part Notice: Undefined index: op_c in D:\wamp\www\sandra\mail.php.php on line 7 a
Partager