I want to $_POST
the ID of the selected radio button. The problem is the value of my radio button is not the ID, but the string title.
foreach($products as $product) {
echo '<input required type="radio" id="'.$product->ID.'" name="product" value="'.$product->post_title.'">';
echo '<label for="'.$product->ID.'">'.$product->post_title.'</label><br>';
echo '<input type="hidden" name="postid" value="'.$product->ID.'">';
}
Is there a way I can "match" that hidden field, so I can access the proper value in $_POST
?
If I just do $_POST["postid"]
it does not work because it just gets the last record from the foreach
loop