Bouton radio

Fermé
maleckk Messages postés 66 Date d'inscription dimanche 28 février 2010 Statut Membre Dernière intervention 9 mai 2010 - 10 avril 2010 à 15:58
maleckk Messages postés 66 Date d'inscription dimanche 28 février 2010 Statut Membre Dernière intervention 9 mai 2010 - 10 avril 2010 à 16:35
bonjour
j'ai un formulaire contenant un bouton radio mais mon probléme que je n'arrive pas à récuperer sa valeur dans la base
voila le code du formulair


<form method="post" name="deposer" action="connouvrirenouveauticket.php">
<table width="366" border="0" align="center">

<tr bgcolor="#969696">
<td align="right">
Description Panne
</td>
<td width="222">
<textarea name="description_panne" cols="15" rows="6"></textarea>
</td>
</tr>

<tr bgcolor="#969696" >
<td align="right">

statut </td>
<td>Résolue<input name="statut" type="radio" value="" />
Non Résolue<input name="statut" type="radio" value="" checked /> </td></tr>
</tr> </table>

et le code de récupération c'est


$type=$_POST["type"];
$description_panne=$_POST["description_panne"];
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost,$dbuser,$dbpass)or die('error connecting to mysql');
$dbname = 'asta';
mysql_select_db($dbname);
$query="insert into ticket_client(type,description_panne)values('$type','$description_panne')";
echo $query;
?>


mercii

2 réponses

avion-f16 Messages postés 19249 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 15 juin 2024 4 503
10 avril 2010 à 16:34
Il faut préciser une valeur dans l'attribut value.

<input name="statut" type="radio" value="oui" id="statut_oui" /> <label for="statut_oui">Résolue</label>
<input name="statut" type="radio" value="non" id="statut_non" checked="checked" id="statut_non" /> <label for="statut_non">Non résolue</label>


Ta variable $_POST['statut'] vaudra "oui" ou "non".
0
maleckk Messages postés 66 Date d'inscription dimanche 28 février 2010 Statut Membre Dernière intervention 9 mai 2010
10 avril 2010 à 16:35
merciii
0