[web] php problem

Started by
0 comments, last by WalterTamboer 17 years, 11 months ago
Hi, I have a form that uses mutiple checkbox values which i am sending to an php file for validation and i can't recieve those values. <form method = "post" action = "calcul.php" name = "form" > <input type = "checkbox" name = "var[]"> unu
<input type = "checkbox" name = "var[]"> doi
<input type = "checkbox" name = "var[]"> trei
<input type = "checkbox" name = "var[]"> patru
<input type = "checkbox" name = "var[]"> cinci
<input type = "submit" name = "submit" value = "submit"> <?php $variable = $_POST['var']; if (is_array{$variable}) { // print me the values } ?> Please help me.
Advertisement
That is because you didn't set a value. The correct way of using is:

<input type="checkbox" name="var[]" value="value 1" /> Value 1<br />
<input type="checkbox" name="var[]" value="value 2" /> Value 2<br />
etc.

Also be sure you're working with the correct PHP version because in PHP 5.1.3 there is a bug with this kind of posting.

In PHP 5.1.4 this bug is fixed.

Good luck

This topic is closed to new replies.

Advertisement