0

Within a php environment we have one checkbox linked to one hidden field with the SAME NAME ($name). How could we send only the values of the selected checkboxes?

php
<input type"checkbox" name="<?echo $filename;?><?echo $variable;?>"
id="filename
<?echo $variable;?>" value="1">

<input type="hidden" name="item_<?echo $filename;?>" value="<?echo $quantity;?>">

In the generated html this checkbox with its own hidden file is then repeted several time with different name ($name).

How can we stop the form to send the value of the unchecked hidden inputs? We cannot use different names nor an array. In the next php page we need to get a single value from each hidden input. We cannot use the array "method" as we then need to use only one variable in a second page rather than the whole array. We cannot "GET" one element via its position within the array as such a position is determined by the individual choice of the end user via a checkbox.

2
Contributors
1
Reply
5
Views
6 Months
Discussion Span
Last Post by vsmash
1

I'm not sure about the clarity of this question but I'll try to help:

  1. All hidden inputs will always post. The only way to prevent it is using javascript;
  2. I'm unclear on your explaination - perhaps a static html form example would help, but from what I see, you could

    <input type"checkbox" name="<?echo $filename;?><?echo $variable;?>"
    id="filename<?echo $variable;?>" value="<?php echo $quantity ?>">

rather than the value "1"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.