I have this simple form:
HTML:
<input type="checkbox" name="product[]" value="20$" /> book
<input type="checkbox" name="product[]" value="30$" /> plane
PHP:
$product = $_POST['product'];
foreach($product as $value) {
echo $value;
}
Note:
The user can choose one or two … products.
Question:
I want to know if there is a solution to get the name too, like adding an ID class or something ..
Basically I cant get the name attribute because I didn’t sent it with the form.
Add the missing information to your POST-parameters:
You can iterate over it like this: