Bonjour
je souhaite récupérer dans une variable (php) la valeur du bouton radio sélectionné sans avoir de bouton type="submit"
j'arrive avec une fonction a afficher la valeur,
mais pas à l'affecter dans une variable php que je pourrais utiliser dans ma page dans un switch($choixtri) par exemple.
ci dessous mon code:
Code html : 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 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.champs_label1//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <HEAD> <link rel="stylesheet" media="screen" type="text/css" href="./css/style.css"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Test1.php</title> <script src="http://www.javascript/xhtml-external-links.js" type="text/javascript"></script> <script> function fx_tri(val) { document.getElementById("choix_du_tri").value=""+val; var valtri = document.getElementById(val) var valtri1 = val.target.value } </script> </head> <body> <div class="corps_page"> <form method="POST" action=""> <center> <p> <fieldset style="background-color: black;"> <span style="color: red; font-size: 14px ">Choix du tri </span> <span style="background-color: black;"> <label style="color: aqua"> <input type="radio" name="btr_tri" value="1" onclick="fx_tri(1)">Par N° [1->9]</label> <label style="color: green"><input type="radio" name="btr_tri" value="2" onclick="fx_tri(2)">Par N° [9->1]</label> <label style="color: aqua"> <input type="radio" name="btr_tri" value="3" onclick="fx_tri(3)">Nom [A->Z]</label> <label style="color: green"><input type="radio" name="btr_tri" value="4" onclick="fx_tri(4)">Nom [Z->A]</label> <label style="color: aqua"> <input type="radio" name="btr_tri" value="5" onclick="fx_tri(5)">Date de cotisation [1->9]</label> <label style="color: green"><input type="radio" name="btr_tri" value="6" onclick="fx_tri(6)">Date de cotisation [9->1]</label> <label style="color: aqua"> <input type="radio" name="btr_tri" value="7" onclick="fx_tri(7)">Date d'envoi carte ALBF [1->9]</label> <label style="color: green"><input type="radio" name="btr_tri" value="8" onclick="fx_tri(8)">Date d'envoi carte ALBF [9->1]</label> </span> </fieldset> </p> </form> <?php echo 'Tri choisi : <input id="choix_du_tri"> <br/> '; ?> </div> </center> </body> </html>
ou comment transformer <input id="choix_du_tri"> en variable PHP?
merci d'avance pour votre aide et vos conseils.
cdt
Partager