Hey everyone,
please help me=p
I have a form, and inside the <form action=... method=POST>
I dynamically create x checkboxes like so:
echo("<TD><INPUT TYPE=CHECKBOX NAME=\"chk_$count\" VALUE=\"$count\">$count</TD>");
$count is a variable that is updated in a loop x times.
I noticed that if you were to check a box, and press submit, its value would pass along to the next form, whereas if you did not check anything, the value would not.
So for example, if i were to check box 3, whose value was 3 based on my above code, and echo("$chk_3"); in the next script
the output would be 3. If i didn't check the 3rd box, and ran the script, it would output nothing..
Now, how could i create a loop which would output the value of
ALL checkboxes? Let's assume we created 20 checkboxes..
I tried something like this:
for($x = 0; $x < 20; $x++)
echo(value: "$chk_" . "$x");
Now from my aforementioned discovery, this should only output the values that were checked. However it just prints all the values
(1,2,3,4,5,..,20)
Why wouldn't it only print the ones that were checked? I suspect that I am completely wrong in concatenating the variable like that.. how does one go about printing out a variable that has 2 parts ($chk_$x)
Thanks in advance for anyone who could assist me.