Skip to content Skip to sidebar Skip to footer

How Can I Use The Array-format Input Field Names In My Html Form That Posts To Php?

I understand the basics of using the array-formatted HTML input names. If I had a form with a variable number of 'item' inputs I might do something like this for each of them: <

Solution 1:

It's not possible to do what you want, but if it helps, here's some code to piece it back together that I think will work (with item_name[] and item_description[]):

$items_desc = $_POST["item_description"];
$items_name = $_POST["item_name"];
$items = array();
for ($i = 0; $i < count($items_name); $i++)
{
    $items[] = array("name" => $items_name[$i], "description" => $items_desc[$i]);
}

Post a Comment for "How Can I Use The Array-format Input Field Names In My Html Form That Posts To Php?"