I have a php form that has a known number of columns (ex. top product, price, quantity, file(file input)), but has an unknown number of rows, as users can add rows as they need.
I am using a multidimensional array:
name="prod[0][name]"
name="prod[0][qty]"
name="prod[0][file]"
on post I use
if ( isset( $_POST['prod'] ) )
{
foreach ( $_POST['prod'] as $value )
{
//some code here
if (isset($_FILES[$value["file"]]["name"]) &&
($_FILES[$value["file"]]["size"] > 0) &&
($_FILES[$value["file"]]["error"]==0) &&
$_FILES[$value["file"]]["name"] != "" )
{
//code of uploading file
}
}
My problem is I can't get the file to be uploaded, I always get the error
$value["file"] is undefined
please help