价值总是一定数量

The value of my id is always 10 ( the last number in my array).

This works fine for my jQuery function, but when using it with the value attribute: it always gives me 10 when doing the get request.

When inspecting my website : value is ok!
enter image description here

When doing a var dump : notice the second value.
enter image description here

I really need this to work to get to the other page.
I'm a bit stucked.

foreach ($data as $key => $value)
{

  if ($count % 4 == 0 && $count != 0)
  {
    echo "<div class=\"container\">";
    echo "<div class=\"row\">";
    echo "</div>";
    echo "</div>";
    echo "<br> <br>";
  }

  $id = $value['id'];
  echo "<div class=\"col-sm-3\">";
  echo "<form method='get' action='..\product\details' class='product-form'>";
  $img = $value["img"];
  $category = $value["category"];
  echo "<div class='panel panel-primary $category' >";
  echo "<div class='panel-heading'>".$value["name"]."</div>";
  echo "<div class='panel-body'><img src='../../public/img/$img' class='img-responsive' style='width:100%' alt='Image'></div>";
  echo " <div class=\"panel-footer\">".$value["description"]."<br><button type='button' class='btn btn-default cart-button'  onclick='addToCart($id)'><span class='glyphicon glyphicon-shopping-cart'></span></button></div>";
  echo "<input type='hidden' name='itemid' value='$id'>";
  echo "</form>";
  echo "</div>";
  echo "</div>";

    $count++;
}

To submit the form I use this:

$(function () {
    $(".col-sm-3").click(function test(event) {
        $(".product-form").submit();
    })
})

Your server side code emits several forms, one per row.

Your jquery will attempt to submit every form that has a CSS class of ".product-form", which means all of them. Each submit will cancel the previous (on most browsers, anyway), so the server only receives a request for the last one.

I think you only want to submit one form-- the form that is a child of the DIV being clicked. So change your jquery:

$(function () {
    $(".col-sm-3").click(function test(event) {
        $(this).find(".product-form").submit();
    })
})