Prashanth Palaniswamy
Prashanth Palaniswamy

Reputation: 352

Trouble in POSTING value of checkbox

HTML:

<tr><td><input name="d1[]" type="checkbox" value"d1e1" /></td><td><input name="d1[]" type="checkbox" value="d2e1" />Event</td><td><input name="d1[]" type="checkbox" value="d3e1" />Event</td></tr>
<tr><td><input name="d1[]" type="checkbox" value"d1e2" />Event</td><td><input name="d1[]" type="checkbox" value="d2e2" />Event</td><td><input name="d1[]" type="checkbox" value="d3e2" />Event</td></tr>
<tr><td><input name="d1[]" type="checkbox"  value"d1e3" />Event</td><td><input name="d1[]" type="checkbox" value="d2e3" />Event</td><td><input name="d1[]" type="checkbox" value="d3e3" />Event</td></tr>

PHP:

<?php
if(!empty($_POST['d1'])&& isset($_POST['d1']))
{
$dd=$_POST['d1'];
foreach($dd as $dp)
{
  echo $dp." <br> ";
}
}
?>

Now the problem is, even though i select all the checkboxes, the values of checkbox in column1 i.e [d1e1, d1e2 & d1e3] are always "on" in output, but for others the values are printed correctly, help me solve my problem. Thanks in advance !

Upvotes: 0

Views: 55

Answers (1)

Erik
Erik

Reputation: 2264

I think you're missing the equal sign for the value attribute.

Upvotes: 3

Related Questions