Jump to content
  • Advertisement
Sign in to follow this  

[web] php problem

This topic is 4420 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post

Link to post
Share on other sites
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 />

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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!