大家好,我是新来的laravel我创建父母的形式,父母填写他的详细信息。所以我的问题是,当用户输入所有的填写和提交按钮时,时间给予错误是未定义的索引:用户名。这个查询的确切原因是什么?我显示了我的控制器和视图
主计长
public function parentStepOne(){
$username = $_REQUEST["username"];
$valid_username = Guardian::where('username', '=', $username)->count();
if($valid_username == 0){
$guardian = new Guardian;
$guardian->username = $username;
$guardian->password = Hash::make($_REQUEST["password"]);
$guardian->save();
Session::put("guardian",$guardian->id);
return Redirect::to("/parents/pstep2");
}
我的看法
<div class="form"> {{ Form::open(array('url' => '/api/v1/parent/parent_step_1', 'class' => "rgform form-horizontal worldoo-form", 'id' => "registrationForm", 'method' => "POST" )) }}
<div class="form-group "> {{ Form::label('username', 'Parent’s Username:', array('class' => "control-label")); }}
<div class=""> {{ Form::text('username', '', array('class' => "form-control", 'id' => "username"));}} </div>
<p>Please confirm your username, your e-mail will be your unique login ID.</p>
</div>
<div class="form-group"> {{ Form::label('password', 'Please choose a password for yourself:', array('class' => "control-label"));}}
<div class=""> {{Form::password('password', array('class' => "form-control", 'id' => "password"));}} </div>
</div>
<div class="form-group "> {{ Form::label('confirm_password', 'Please re - enter the same password:', array('class' => "control-label"));}}
<div class=""> {{Form::password('confirm_password', array('class' => "form-control", 'id' => "confirm_password"));}} </div>
<p>Please remember or note your password you will need it to log into worldoo as a parent.</p>
</div>
<div class="form-group">
<div class="text-center"> {{Form::submit('Next', array('class' => "btn btn-primary worldoo-btn"));}} </div>
</div>
{{ Form::close() }} </div>
}
1条答案
按热度按时间thtygnil1#
尝试:
$username = Input::get('username');