Checkbox selected lors d'un rafraichissement

Fermé
cedric12 Messages postés 29 Date d'inscription lundi 12 septembre 2005 Statut Membre Dernière intervention 3 mai 2006 - 16 sept. 2005 à 12:11
 happyrain - 12 sept. 2012 à 12:31
bonjour,

sur mon site l'utilisateur rempli les cases d'un formulaire avec checkbox.
Je souhaite lorsque la nouvelle page apparait que la case reste cochée. Comment faire?

Merci

2 réponses

Bonjour,

Tu utilises quoi pour créér ta checkbox ?

En html si tu mets ca elle doit être toujours cochée:
type="checkbox" name="Nom" class="menuradio" value="VisuEc" checked
0
commet faire avec java
0
il faudrai faire un script php du genre:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>
<body bgcolor="#FFFFFF">
<hr />
<form action="toto.php" name="titi" method="post">
<input type="submit" name="bt_ok" />
<?


/* pour 10 chekbox */
for ($i=0;$i<=9;$i++){
$etat="";
$nom="coche" . $i;
if (isset($_POST[$nom])){
$valeur=$_POST[$nom];
if ($valeur=="on"){
$etat="checked";
}
}
echo "<input type=\"checkbox\" name=\"$nom\" $etat/>Coche $i";
}

?>
</form>
</body>
</html>


et ça devrai marcher
0
j'ai oublié il faut appeller ta page 'toto.php'
0
c'est pas plutôt => checked="checked" ?
0