I'm working on this simple form and trying to submit it. Basically I created an array of users in my HomeController.php which then renders its data in the home.blade.php file (That part works fine). However when I try to submit the form I get an error that says: Undefined variable: usersArray .Can anyone tell me what I'm doing wrong please? thank you so much in advance.
Here's my Home.blade.php
{!! Form::open(array('id' => 'activateForm')) !!} {!! csrf_field() !!} <div> <!---Error messages inside of box--> <div style="padding-left: 135px; width:815px;"> @if (count($errors) > 0) <div class="alert alert-danger"> <ul class = "login-error-messages" style = "list-style-type:disc;"> @foreach ($errors->all() as $error) <li>{!! $error !!}</li> @endforeach </ul> </div> @endif </div> <div class="home-rounded-border center-content"> <input type = "checkbox" id = "checkAll" />Select All<span style="padding-left: 310px;font-weight: bold;">Email</span><br/> @foreach($usersArray as $key => $value) <ul> <li> <input type="checkbox" id="checkboxUser{{$key}}" name="user-name-checkbox{{$key}} ">{{$value}} <input type = "email" class="styled-text rounded" name = "name" id = "customer-name-inputField{{$key}}" placeholder=""/><br/><br/> </li> </ul> @endforeach <center><input type = "submit" class="sign-in-button"value = "Submit"/></center> </br> <div id="statusMsg" style="margin: 0px 40px 0px 40px; background-color: #ffffff;"></div> <ul><li class="logout"><a href="logout"><span>Logout</span></a></li></ul> </div> <br/><br/> </div> {!! Form::close() !!}