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?

<input type"checkbox" name="<?echo $filename;?><?echo $variable;?>"
<?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.

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"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.