Chack for input array if it's empty or not

Posted 1 month ago by johnef_sh

I have an input looks like this.

{!! Form::text('inventory[0][amount]', null, ['class'=>'form-control']) !!}
{!! Form::text('inventory[0][expiry_date]', null, ['data-format'=>'D, dd MM yyyy', 'class'=>'form-control']) !!}

print_r( $_POST ); results

 [inventory] => Array ( [0] => Array ( [amount] => 66 [expiry_date] => 2019/05/20 ) )

I am trying to check if the amount and the expiry_date are not null

if ( $input['inventory[0][amount]'] and $input['inventory[0][expiry_date]'] != null )

but I got

Undefined index: inventory[0][amount]

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.