There are 3 checkboxes, you need to accumulate a variable when you click on each of them. Those.:

<INPUT TYPE="CHECKBOX" id="CH1" name="f1" VALUE="1"> Ракетка<BR> <INPUT TYPE="CHECKBOX" id="CH2" name="f2" VALUE="2"> Кроссовки<BR> <INPUT TYPE="CHECKBOX" id="CH3" name="f3" VALUE="3"> Теннисный мяч<BR> 

For example, when you click on the 1st checkbox, a number is added to some $sum variable, if the check mark is removed, then the number is also subtracted. When you click on the 2nd checkbox, add some number again and also with the third check. Is this possible to implement? If so, how?

  • All these inputs and the corresponding clicks “live” in the browser, and not on the server, so you need to either send an ajax request for each click, or read on the browser side with JavaScript. - Surfin Bird
  • It is not right. Look at your three lines. If the number is 3, what does this mean? Selected tennis ball or racket + sneakers? - Sergey
  • All checkboxes are given the same name as array[] (the name of the array with square brackets at the end) and the server receives a list of selected options in the array []. - Sergey
  • More about the addition. So that by the sum it was possible to unambiguously establish what was chosen, it is necessary that value be powers of two. Then each value establishes only its own digit in the sum and thus unambiguity is achieved. f1 = 1 f2 = 2 f4 = 4 f5 = 8 ... The sum of two or more such numbers will never coincide with one of the values. - Sergey

0