I am creating a shopping cart function which adds items to the cart, then if the user presses the order button then I want the data to be posted across to my PHP page. I have the following HTML
<div class="main">
<form action = "test.php" method = "POST">
<div class = "cart-items">
</div>
<div class="btn btn-primary btn-purchase"><input type = "submit" name ="submit" class="btn_1 gradient full-width mb_5">Order Now></div>
</form>
</div>
I populate the "cart-items" class using javascript,
var cartRowContents =
`<ul class="clearfix">
<div class="cart-item cart-column">
<li class = 'remove'>
<a href="#0"><input type = "hidden" name = "selectedIDs[]" value="${itemID}"></a>
</li>
</div>
</ul>`
The href tag only has css applied to it, I tested removing the tag to see if that was the issue but it still didn't show the "selectedIDs" post data.
The code I have in test.php is below. The form is posting, as I can see inside the isset function, but the only thing posting is the "submit" from the submit button.
<?php
if(isset($_POST["submit"]))
{
echo "yes it has submitted";
}
print_r($_POST);
?>
See below how the cart looks in the console log. There are other elements within the "cart-items" class but I took them out of this example to keep things clear.

cart-quantity-inputdoesn't have a name attribute, so that won't show up in your $_POST variable. I'm not sure if that will fix all of the issues, but it might be a start.