我正在处理这个简单的表单并尝试提交它。基本上我在HomeController.php中创建了一个用户数组,然后在home.blade.php文件中呈现它的数据(该部分工作正常)。但是,当我尝试提交表单时,我收到一条错误消息:未定义变量:usersArray 。任何人都可以告诉我,我做错了吗?非常感谢你。
这是我的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() !!}
答案 0 :(得分:2)
return view('home', ['userId' => $adminId]);
activateCustomer
。$usersArray
。您正试图在没有Delete data or table