I have this code for that “sends by” GET true or false concerning if a checkbox is checked or not:
var isChecked = document.myform.checkbox.checked ? 1 : 0;
var isChecked0 = document.myform.checkbox0.checked ? 1 : 0;
var isChecked1 = document.myform.checkbox1.checked ? 1 : 0;
xmlhttp.open("GET","roulette2.php?boxchecked=" + isChecked,true);
xmlhttp.send();
The html goes like this:
<input type="checkbox" name="checkbox" value="checkbox" />00<br />
<input type="checkbox" name="checkbox0" value="checkbox" />0<br />
<input type="checkbox" name="checkbox1" value="checkbox" />1<br />
As you can se up there in:
xmlhttp.open("GET","roulette2.php?boxchecked=" + isChecked,true);
This only verifies whether the first checkbox is clicked and not the other ones.
How can you modify the xmlhttp.open to vige the 3 checkboxes the “option to be checked”.
Thanks in advance!!
Trufa
You want to send all checked states in one variable?
Concatenate the states in a string:
You get 000 if none is checked 001 if chekbox is checked, and 111 if all is checked.
UPDATE
I looked at your code again, and saw roulette… Are you writing a roulette-game? Then this might be useful:
And with HTML markup like:
In your php-code you have to decode the values: