U probeert een waarde met dezelfde naam toe te wijzen. Dus uw laatste waarde wordt vervangen door de bestaande waarde.
bijvoorbeeld:uw URL ziet eruit als,
https://www.example.com/index.php?finished_product_name=abc&material_name=xxx&finished_product_name=pqr&material_name=yyy
dus je $_GET['finished_product_name'] heeft waarde is pqr niet abc .
Als u de veldnaam kunt wijzigen met include [] , dan maakt PHP een array met alle overeenkomende waarden:
https://www.example.com/index.php?id[]=123&version[]=3&id[]=234&version[]=4
uw URL-voorbeeld zoals,
https://www.example.com/index.php?finished_product_name[]=abc&material_name[]=xxx&finished_product_name[]=pqr&material_name[]=yyy
je for-lus is:
for ($i=0; $i < count($_POST['finished_product_name']); $i++ )
{
$product =$_POST['finished_product_name'][$i];
$material = $_POST['material_name'][$i];
$quantity = $_POST'product_quantity'][$i];
}