Bonjour,
J'ai un problème avec un formulaire qui fonctionne plus depuis que je suis sur un serveur dédié.
Un javascript limite à 2 choix possibles parmis les checkbox (ça ça fonctionne) mais lorsque je valide le formulaire, je ne récupére rien du tout dans les variables $champ[0] et $champ[1].
Et comme php n'accepte pas que j'écrive $_GET[champ[0]] , je suis coincée.
Quelqu'un pourrait m'aider ? merci d'avance.
[B][COLOR="Blue"][Index.php][/COLOR][/B]
[CODE]
<script language="JavaScript">
function limite_check(nom_champ, nbre_limit) {
var nbre = 0; var nbre_check = 0;
nom = document.getElementById('form_profil').elements[nom_champ];
nbre_check = nom.length;
for(i = 0; i < nbre_check; i++) { if(nom[i].checked == true) nbre++; }
if(nbre >= nbre_limit)
{
for(i = 0; i < nbre_check; i++) { if(nom[i].checked == false) nom[i].disabled = true; }
}
else { for(i = 0; i < nbre_check; i++) { if(nom[i].checked == false) nom[i].disabled = false; }}}
</script>
<FORM class="formulaire-profil" id="form_profil" action="caddy.php" method="GET">
<input name="champ[]" type="checkbox" value="produit1" onclick="limite_check(this.name, 2);">Produit 1<br>
<input name="champ[]" type="checkbox" value="produit2" onclick="limite_check(this.name, 2);">Produit 2<br>
<input name="champ[]" type="checkbox" value="produit3" onclick="limite_check(this.name, 2);">Produit 3<br>
<input name="champ[]" type="checkbox" value="produit4" onclick="limite_check(this.name, 2);">Produit 4<br>
</FORM>
[/CODE]
[B][COLOR="Blue"][resultat.php][/COLOR][/B]
[CODE]
echo "champ[0] ".=$champ[0]."<br>";
echo "champ[1] ".=$champ[2]."<br>";
[/CODE]