I'm working on this simple form and trying to submit it. Basically I created an user's array in my homeController 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 HomeController which has the values for my usersArray:
public function home()
{
$usersArray = array();
$usersArray[0] = "Mike" . " "."Brown" . " " . "3032023245";
$usersArray[1] = "Michael" . " " . "Smith" . " ". "7204506534";
$usersArray[2] = "Lauren" . " ". "Barl". " ". "7202314687";
return view('home', [
'usersArray' => $usersArray
]);
}
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" name="user-name-checkbox ">
<input type = "email" class="styled-text rounded" name = "name" id = "customer-name-inputField}}" 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() !!}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire