How to retrieve value from the Check boxes?

后端 未结 2 1618
轻奢々
轻奢々 2021-01-25 04:13

I\'m trying to get the emails corresponding to the checkbox using the following codes. But, I\'m not getting the correct checked emails in the new variable. Can anyone please ch

相关标签:
2条回答
  • 2021-01-25 04:40
    <input type="checkbox" name="add" value="<?php echo $msg.$info['email'];?>"/>
    

    checkbox does not have onSelect event probobly you got value in mind and in PHP code you should echo and what .", " is for?

    0 讨论(0)
  • 2021-01-25 04:56

    To get any value back for checkboxes they must have a value=. In your case you probably would want the value to be the according email address.

    One problem with your code is using onSelect= instead of value=, and second you didn't print the actual value into the page. Rewrite it to:

    <td width="21" bgcolor="#f2f2f2">
        <input type="checkbox" name="add"
         value="<?php print $info['email']; ?>"/> </td>
    

    If you need the $msg variable to do something, assemble it after the output.

    0 讨论(0)
提交回复
热议问题