Laravel is not grabbing all my input values
I am a newbie to laravel and I've been trying to grab form input values and submit to the database but i've been having errors.
Please i would be happy if you can help me look through it and help check where i am missing the input values.
[2018-11-23 11:20:26] development.ERROR: SQLSTATE[23000]: Integrity
constraint violation: 1048 Column 'local_govt_id' cannot be null (SQL:
insert intousers_signedups
(state_id
,local_govt_id
,
first_name
,surname
,phone_number
,date_of_birth
,title
,
education_level_id
,discipline
,work_address
,res_address
,
occupation
,gender
,marital_status
,make_donations
,
be_a_member
,be_a_volunteer
,about_you
,password
,
updated_at
,created_at
) values (1, , , , , , , , , , , , , , , , ,
, lawalmariamyetunde@gmail.com, , 2018-11-23 11:20:23, 2018-11-23
11:20:23)) {"exception":"[object]
(IlluminateDatabaseQueryException(code: 23000): SQLSTATE[23000]:
Integrity constraint violation: 1048 Column 'local_govt_id' cannot be
null (SQL: insert intousers_signedups
(state_id
,local_govt_id
,
first_name
,surname
,phone_number
,date_of_birth
,title
,
education_level_id
,discipline
,work_address
,res_address
,
occupation
,gender
,marital_status
,make_donations
,
be_a_member
,be_a_volunteer
,about_you
,password
,
updated_at
,created_at
) values (1, , , , , , , , , , , , , , , , ,
, app@gmail.com, , 2018-11-23 11:20:23, 2018-11-23 11:20:23)) at
C:UsersUSER
my controller is
namespace AppHttpControllers;
use IlluminateHttpRequest;
//use AppHttpControllersController;
use Appusers_signedup;
class UsersSignedupController extends Controller
{
public function signup(Request $request)
{
return view('signup');
}
public function postUserSignupDetails(Request $request)
{
$validatedData = $request->validate([
'state_id' => 'required',
'local_govt_id' => 'required',
'first_name' => 'required',
'surname' => 'required',
'phone_number' => 'required',
'date_of_birth' => 'required',
'title' => 'required',
'education_level_id' => 'required|numeric',
'discipline' => 'required',
'res_address' => 'required',
'work_address' => 'required',
'occupation' => 'required',
'gender' => 'required|numeric',
'marital_status' => 'required|numeric',
'make_donations' => 'numeric',
'be_a_member' => 'numeric',
'be_a_volunteer' => 'numeric',
'about_you' => 'required',
'email' => 'required|unique:users_signedups',
'password' => 'required'
]);
}
public function store(Request $request)
{
// $users_signedup = $request->session()->get('users_signedup');
$userModel = new users_signedup;
//$userModel = new UserModel;
// dd($request->email);
// $request->state_id
$userModel->state_id = $request->state_id;
$userModel->local_govt_id = $request->local_govt_id;
$userModel->first_name = $request->first_name;
$userModel->surname = $request->surname;
$userModel->phone_number = $request->phone_number;
$userModel->date_of_birth = $request->date_of_birth;
$userModel->title = $request->title;
$userModel->education_level_id = $request->education_level_id;
$userModel->discipline = $request->discipline;
$userModel->work_address = $request->work_address;
$userModel->res_address = $request->res_address;
$userModel->occupation = $request->occupation;
$userModel->gender = $request->gender;
$userModel->marital_status = $request->marital_status;
$userModel->make_donations = $request->make_donations;
$userModel->be_a_member = $request->be_a_member;
$userModel->be_a_volunteer = $request->be_a_volunteer;
$userModel->about_you = $request->about_you;
$userModel->email = $request->email;
$userModel->password = $request->password;
$userModel->save();
return redirect('/signup/success');
}
my model is
<?php
namespace App;
use IlluminateDatabaseEloquentModel;
class users_signedup extends Model
{
protected $guarded = ;
}
my view is
<form action="signup/store" method="post">
{{ csrf_field() }}
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="state_id" placeholder="Choose your State of Residence" required>
<option value="">Choose your State of Residence</option>
<option value="1">Abia State</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="local_govt_id" placeholder="Choose your Local Government Area" required>
<option value="">Choose your Local Government Area</option>
<option value="1">Umahia</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="first_name" placeholder="First Name" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="surname" placeholder="Surname" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="phone_number" placeholder="Phone" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="date_of_birth" placeholder="Date of Birth" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="title" placeholder="Title" required>
<option value="">Choose your Title</option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Miss">Miss</option>
<option value="Prof">Prof</option>
<option value="Chief">Chief</option>
<option value="Dr.">Dr.</option>
<option value="Hon.">Hon.</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="marital_status" placeholder="Marital Status" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="education_level_id" placeholder="Education Level" required>
<option value="">Choose your Education Level</option>
<option value="none">No Education</option>
<option value="primary">Primary</option>
<option value="secondary">Secondary</option>
<option value="tertiary">Tertiary</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="discipline" placeholder="Discipline" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<textarea class="form-control" name="res_address" data-gramm="true" spellcheck="false" data-gramm_editor="true" placeholder="Residential Address" required="required"></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<textarea class="form-control" name="work_address" data-gramm="true" spellcheck="false" data-gramm_editor="true" placeholder="Workplace Address" required="required">
{{ route('signup') }}
{{ csrf_field() }}
</textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="occupation" placeholder="Occupation" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="email" name="email" placeholder="Email" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="password" placeholder="Password" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{--<div class="g-recaptcha" data-sitekey="6LfXfnwUAAAAAIJW_OYS6viKZ-ydqSn5_-obFdys"></div>--}}
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
</div>
<button class="sub-btn donate-btn more-btn hvr-shutter-out-horizontal">send</button>
</div>
</form>
php mysql laravel
add a comment |
I am a newbie to laravel and I've been trying to grab form input values and submit to the database but i've been having errors.
Please i would be happy if you can help me look through it and help check where i am missing the input values.
[2018-11-23 11:20:26] development.ERROR: SQLSTATE[23000]: Integrity
constraint violation: 1048 Column 'local_govt_id' cannot be null (SQL:
insert intousers_signedups
(state_id
,local_govt_id
,
first_name
,surname
,phone_number
,date_of_birth
,title
,
education_level_id
,discipline
,work_address
,res_address
,
occupation
,gender
,marital_status
,make_donations
,
be_a_member
,be_a_volunteer
,about_you
,password
,
updated_at
,created_at
) values (1, , , , , , , , , , , , , , , , ,
, lawalmariamyetunde@gmail.com, , 2018-11-23 11:20:23, 2018-11-23
11:20:23)) {"exception":"[object]
(IlluminateDatabaseQueryException(code: 23000): SQLSTATE[23000]:
Integrity constraint violation: 1048 Column 'local_govt_id' cannot be
null (SQL: insert intousers_signedups
(state_id
,local_govt_id
,
first_name
,surname
,phone_number
,date_of_birth
,title
,
education_level_id
,discipline
,work_address
,res_address
,
occupation
,gender
,marital_status
,make_donations
,
be_a_member
,be_a_volunteer
,about_you
,password
,
updated_at
,created_at
) values (1, , , , , , , , , , , , , , , , ,
, app@gmail.com, , 2018-11-23 11:20:23, 2018-11-23 11:20:23)) at
C:UsersUSER
my controller is
namespace AppHttpControllers;
use IlluminateHttpRequest;
//use AppHttpControllersController;
use Appusers_signedup;
class UsersSignedupController extends Controller
{
public function signup(Request $request)
{
return view('signup');
}
public function postUserSignupDetails(Request $request)
{
$validatedData = $request->validate([
'state_id' => 'required',
'local_govt_id' => 'required',
'first_name' => 'required',
'surname' => 'required',
'phone_number' => 'required',
'date_of_birth' => 'required',
'title' => 'required',
'education_level_id' => 'required|numeric',
'discipline' => 'required',
'res_address' => 'required',
'work_address' => 'required',
'occupation' => 'required',
'gender' => 'required|numeric',
'marital_status' => 'required|numeric',
'make_donations' => 'numeric',
'be_a_member' => 'numeric',
'be_a_volunteer' => 'numeric',
'about_you' => 'required',
'email' => 'required|unique:users_signedups',
'password' => 'required'
]);
}
public function store(Request $request)
{
// $users_signedup = $request->session()->get('users_signedup');
$userModel = new users_signedup;
//$userModel = new UserModel;
// dd($request->email);
// $request->state_id
$userModel->state_id = $request->state_id;
$userModel->local_govt_id = $request->local_govt_id;
$userModel->first_name = $request->first_name;
$userModel->surname = $request->surname;
$userModel->phone_number = $request->phone_number;
$userModel->date_of_birth = $request->date_of_birth;
$userModel->title = $request->title;
$userModel->education_level_id = $request->education_level_id;
$userModel->discipline = $request->discipline;
$userModel->work_address = $request->work_address;
$userModel->res_address = $request->res_address;
$userModel->occupation = $request->occupation;
$userModel->gender = $request->gender;
$userModel->marital_status = $request->marital_status;
$userModel->make_donations = $request->make_donations;
$userModel->be_a_member = $request->be_a_member;
$userModel->be_a_volunteer = $request->be_a_volunteer;
$userModel->about_you = $request->about_you;
$userModel->email = $request->email;
$userModel->password = $request->password;
$userModel->save();
return redirect('/signup/success');
}
my model is
<?php
namespace App;
use IlluminateDatabaseEloquentModel;
class users_signedup extends Model
{
protected $guarded = ;
}
my view is
<form action="signup/store" method="post">
{{ csrf_field() }}
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="state_id" placeholder="Choose your State of Residence" required>
<option value="">Choose your State of Residence</option>
<option value="1">Abia State</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="local_govt_id" placeholder="Choose your Local Government Area" required>
<option value="">Choose your Local Government Area</option>
<option value="1">Umahia</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="first_name" placeholder="First Name" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="surname" placeholder="Surname" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="phone_number" placeholder="Phone" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="date_of_birth" placeholder="Date of Birth" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="title" placeholder="Title" required>
<option value="">Choose your Title</option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Miss">Miss</option>
<option value="Prof">Prof</option>
<option value="Chief">Chief</option>
<option value="Dr.">Dr.</option>
<option value="Hon.">Hon.</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="marital_status" placeholder="Marital Status" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="education_level_id" placeholder="Education Level" required>
<option value="">Choose your Education Level</option>
<option value="none">No Education</option>
<option value="primary">Primary</option>
<option value="secondary">Secondary</option>
<option value="tertiary">Tertiary</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="discipline" placeholder="Discipline" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<textarea class="form-control" name="res_address" data-gramm="true" spellcheck="false" data-gramm_editor="true" placeholder="Residential Address" required="required"></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<textarea class="form-control" name="work_address" data-gramm="true" spellcheck="false" data-gramm_editor="true" placeholder="Workplace Address" required="required">
{{ route('signup') }}
{{ csrf_field() }}
</textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="occupation" placeholder="Occupation" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="email" name="email" placeholder="Email" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="password" placeholder="Password" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{--<div class="g-recaptcha" data-sitekey="6LfXfnwUAAAAAIJW_OYS6viKZ-ydqSn5_-obFdys"></div>--}}
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
</div>
<button class="sub-btn donate-btn more-btn hvr-shutter-out-horizontal">send</button>
</div>
</form>
php mysql laravel
Error is about something else. Your provided data doesn't comply tables constraints.
– Tpojka
Nov 23 '18 at 14:20
add a comment |
I am a newbie to laravel and I've been trying to grab form input values and submit to the database but i've been having errors.
Please i would be happy if you can help me look through it and help check where i am missing the input values.
[2018-11-23 11:20:26] development.ERROR: SQLSTATE[23000]: Integrity
constraint violation: 1048 Column 'local_govt_id' cannot be null (SQL:
insert intousers_signedups
(state_id
,local_govt_id
,
first_name
,surname
,phone_number
,date_of_birth
,title
,
education_level_id
,discipline
,work_address
,res_address
,
occupation
,gender
,marital_status
,make_donations
,
be_a_member
,be_a_volunteer
,about_you
,password
,
updated_at
,created_at
) values (1, , , , , , , , , , , , , , , , ,
, lawalmariamyetunde@gmail.com, , 2018-11-23 11:20:23, 2018-11-23
11:20:23)) {"exception":"[object]
(IlluminateDatabaseQueryException(code: 23000): SQLSTATE[23000]:
Integrity constraint violation: 1048 Column 'local_govt_id' cannot be
null (SQL: insert intousers_signedups
(state_id
,local_govt_id
,
first_name
,surname
,phone_number
,date_of_birth
,title
,
education_level_id
,discipline
,work_address
,res_address
,
occupation
,gender
,marital_status
,make_donations
,
be_a_member
,be_a_volunteer
,about_you
,password
,
updated_at
,created_at
) values (1, , , , , , , , , , , , , , , , ,
, app@gmail.com, , 2018-11-23 11:20:23, 2018-11-23 11:20:23)) at
C:UsersUSER
my controller is
namespace AppHttpControllers;
use IlluminateHttpRequest;
//use AppHttpControllersController;
use Appusers_signedup;
class UsersSignedupController extends Controller
{
public function signup(Request $request)
{
return view('signup');
}
public function postUserSignupDetails(Request $request)
{
$validatedData = $request->validate([
'state_id' => 'required',
'local_govt_id' => 'required',
'first_name' => 'required',
'surname' => 'required',
'phone_number' => 'required',
'date_of_birth' => 'required',
'title' => 'required',
'education_level_id' => 'required|numeric',
'discipline' => 'required',
'res_address' => 'required',
'work_address' => 'required',
'occupation' => 'required',
'gender' => 'required|numeric',
'marital_status' => 'required|numeric',
'make_donations' => 'numeric',
'be_a_member' => 'numeric',
'be_a_volunteer' => 'numeric',
'about_you' => 'required',
'email' => 'required|unique:users_signedups',
'password' => 'required'
]);
}
public function store(Request $request)
{
// $users_signedup = $request->session()->get('users_signedup');
$userModel = new users_signedup;
//$userModel = new UserModel;
// dd($request->email);
// $request->state_id
$userModel->state_id = $request->state_id;
$userModel->local_govt_id = $request->local_govt_id;
$userModel->first_name = $request->first_name;
$userModel->surname = $request->surname;
$userModel->phone_number = $request->phone_number;
$userModel->date_of_birth = $request->date_of_birth;
$userModel->title = $request->title;
$userModel->education_level_id = $request->education_level_id;
$userModel->discipline = $request->discipline;
$userModel->work_address = $request->work_address;
$userModel->res_address = $request->res_address;
$userModel->occupation = $request->occupation;
$userModel->gender = $request->gender;
$userModel->marital_status = $request->marital_status;
$userModel->make_donations = $request->make_donations;
$userModel->be_a_member = $request->be_a_member;
$userModel->be_a_volunteer = $request->be_a_volunteer;
$userModel->about_you = $request->about_you;
$userModel->email = $request->email;
$userModel->password = $request->password;
$userModel->save();
return redirect('/signup/success');
}
my model is
<?php
namespace App;
use IlluminateDatabaseEloquentModel;
class users_signedup extends Model
{
protected $guarded = ;
}
my view is
<form action="signup/store" method="post">
{{ csrf_field() }}
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="state_id" placeholder="Choose your State of Residence" required>
<option value="">Choose your State of Residence</option>
<option value="1">Abia State</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="local_govt_id" placeholder="Choose your Local Government Area" required>
<option value="">Choose your Local Government Area</option>
<option value="1">Umahia</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="first_name" placeholder="First Name" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="surname" placeholder="Surname" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="phone_number" placeholder="Phone" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="date_of_birth" placeholder="Date of Birth" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="title" placeholder="Title" required>
<option value="">Choose your Title</option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Miss">Miss</option>
<option value="Prof">Prof</option>
<option value="Chief">Chief</option>
<option value="Dr.">Dr.</option>
<option value="Hon.">Hon.</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="marital_status" placeholder="Marital Status" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="education_level_id" placeholder="Education Level" required>
<option value="">Choose your Education Level</option>
<option value="none">No Education</option>
<option value="primary">Primary</option>
<option value="secondary">Secondary</option>
<option value="tertiary">Tertiary</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="discipline" placeholder="Discipline" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<textarea class="form-control" name="res_address" data-gramm="true" spellcheck="false" data-gramm_editor="true" placeholder="Residential Address" required="required"></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<textarea class="form-control" name="work_address" data-gramm="true" spellcheck="false" data-gramm_editor="true" placeholder="Workplace Address" required="required">
{{ route('signup') }}
{{ csrf_field() }}
</textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="occupation" placeholder="Occupation" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="email" name="email" placeholder="Email" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="password" placeholder="Password" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{--<div class="g-recaptcha" data-sitekey="6LfXfnwUAAAAAIJW_OYS6viKZ-ydqSn5_-obFdys"></div>--}}
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
</div>
<button class="sub-btn donate-btn more-btn hvr-shutter-out-horizontal">send</button>
</div>
</form>
php mysql laravel
I am a newbie to laravel and I've been trying to grab form input values and submit to the database but i've been having errors.
Please i would be happy if you can help me look through it and help check where i am missing the input values.
[2018-11-23 11:20:26] development.ERROR: SQLSTATE[23000]: Integrity
constraint violation: 1048 Column 'local_govt_id' cannot be null (SQL:
insert intousers_signedups
(state_id
,local_govt_id
,
first_name
,surname
,phone_number
,date_of_birth
,title
,
education_level_id
,discipline
,work_address
,res_address
,
occupation
,gender
,marital_status
,make_donations
,
be_a_member
,be_a_volunteer
,about_you
,password
,
updated_at
,created_at
) values (1, , , , , , , , , , , , , , , , ,
, lawalmariamyetunde@gmail.com, , 2018-11-23 11:20:23, 2018-11-23
11:20:23)) {"exception":"[object]
(IlluminateDatabaseQueryException(code: 23000): SQLSTATE[23000]:
Integrity constraint violation: 1048 Column 'local_govt_id' cannot be
null (SQL: insert intousers_signedups
(state_id
,local_govt_id
,
first_name
,surname
,phone_number
,date_of_birth
,title
,
education_level_id
,discipline
,work_address
,res_address
,
occupation
,gender
,marital_status
,make_donations
,
be_a_member
,be_a_volunteer
,about_you
,password
,
updated_at
,created_at
) values (1, , , , , , , , , , , , , , , , ,
, app@gmail.com, , 2018-11-23 11:20:23, 2018-11-23 11:20:23)) at
C:UsersUSER
my controller is
namespace AppHttpControllers;
use IlluminateHttpRequest;
//use AppHttpControllersController;
use Appusers_signedup;
class UsersSignedupController extends Controller
{
public function signup(Request $request)
{
return view('signup');
}
public function postUserSignupDetails(Request $request)
{
$validatedData = $request->validate([
'state_id' => 'required',
'local_govt_id' => 'required',
'first_name' => 'required',
'surname' => 'required',
'phone_number' => 'required',
'date_of_birth' => 'required',
'title' => 'required',
'education_level_id' => 'required|numeric',
'discipline' => 'required',
'res_address' => 'required',
'work_address' => 'required',
'occupation' => 'required',
'gender' => 'required|numeric',
'marital_status' => 'required|numeric',
'make_donations' => 'numeric',
'be_a_member' => 'numeric',
'be_a_volunteer' => 'numeric',
'about_you' => 'required',
'email' => 'required|unique:users_signedups',
'password' => 'required'
]);
}
public function store(Request $request)
{
// $users_signedup = $request->session()->get('users_signedup');
$userModel = new users_signedup;
//$userModel = new UserModel;
// dd($request->email);
// $request->state_id
$userModel->state_id = $request->state_id;
$userModel->local_govt_id = $request->local_govt_id;
$userModel->first_name = $request->first_name;
$userModel->surname = $request->surname;
$userModel->phone_number = $request->phone_number;
$userModel->date_of_birth = $request->date_of_birth;
$userModel->title = $request->title;
$userModel->education_level_id = $request->education_level_id;
$userModel->discipline = $request->discipline;
$userModel->work_address = $request->work_address;
$userModel->res_address = $request->res_address;
$userModel->occupation = $request->occupation;
$userModel->gender = $request->gender;
$userModel->marital_status = $request->marital_status;
$userModel->make_donations = $request->make_donations;
$userModel->be_a_member = $request->be_a_member;
$userModel->be_a_volunteer = $request->be_a_volunteer;
$userModel->about_you = $request->about_you;
$userModel->email = $request->email;
$userModel->password = $request->password;
$userModel->save();
return redirect('/signup/success');
}
my model is
<?php
namespace App;
use IlluminateDatabaseEloquentModel;
class users_signedup extends Model
{
protected $guarded = ;
}
my view is
<form action="signup/store" method="post">
{{ csrf_field() }}
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="state_id" placeholder="Choose your State of Residence" required>
<option value="">Choose your State of Residence</option>
<option value="1">Abia State</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="local_govt_id" placeholder="Choose your Local Government Area" required>
<option value="">Choose your Local Government Area</option>
<option value="1">Umahia</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="first_name" placeholder="First Name" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="surname" placeholder="Surname" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="phone_number" placeholder="Phone" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="date_of_birth" placeholder="Date of Birth" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="title" placeholder="Title" required>
<option value="">Choose your Title</option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Miss">Miss</option>
<option value="Prof">Prof</option>
<option value="Chief">Chief</option>
<option value="Dr.">Dr.</option>
<option value="Hon.">Hon.</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="marital_status" placeholder="Marital Status" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select class="form-control" name="education_level_id" placeholder="Education Level" required>
<option value="">Choose your Education Level</option>
<option value="none">No Education</option>
<option value="primary">Primary</option>
<option value="secondary">Secondary</option>
<option value="tertiary">Tertiary</option>
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="discipline" placeholder="Discipline" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<textarea class="form-control" name="res_address" data-gramm="true" spellcheck="false" data-gramm_editor="true" placeholder="Residential Address" required="required"></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<textarea class="form-control" name="work_address" data-gramm="true" spellcheck="false" data-gramm_editor="true" placeholder="Workplace Address" required="required">
{{ route('signup') }}
{{ csrf_field() }}
</textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="occupation" placeholder="Occupation" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="email" name="email" placeholder="Email" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" type="text" name="password" placeholder="Password" required>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{--<div class="g-recaptcha" data-sitekey="6LfXfnwUAAAAAIJW_OYS6viKZ-ydqSn5_-obFdys"></div>--}}
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
</div>
<button class="sub-btn donate-btn more-btn hvr-shutter-out-horizontal">send</button>
</div>
</form>
php mysql laravel
php mysql laravel
edited Nov 23 '18 at 13:35
Jignesh Joisar
2,3531819
2,3531819
asked Nov 23 '18 at 11:37
Mariam
12
12
Error is about something else. Your provided data doesn't comply tables constraints.
– Tpojka
Nov 23 '18 at 14:20
add a comment |
Error is about something else. Your provided data doesn't comply tables constraints.
– Tpojka
Nov 23 '18 at 14:20
Error is about something else. Your provided data doesn't comply tables constraints.
– Tpojka
Nov 23 '18 at 14:20
Error is about something else. Your provided data doesn't comply tables constraints.
– Tpojka
Nov 23 '18 at 14:20
add a comment |
3 Answers
3
active
oldest
votes
You are currently just calling the name of the fields from the request object. The correct code would be
$model->input = $request->input('input_name');
Take a look here for more info.
add a comment |
You should try this:
$inputData = $request->all()
users_signedup::create($inputData);
OR
DB::table('users_signedup')->insert($inputData);
add a comment |
<option value="***enter default value***">Choose your Local Government Area</option>
You need to force users to select an option or you can assign a default value.
Also you can make this field in your database nullable or with a default value.
Please check all of your inputs about null options. Your whole code seems fine to me except this.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445989%2flaravel-is-not-grabbing-all-my-input-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are currently just calling the name of the fields from the request object. The correct code would be
$model->input = $request->input('input_name');
Take a look here for more info.
add a comment |
You are currently just calling the name of the fields from the request object. The correct code would be
$model->input = $request->input('input_name');
Take a look here for more info.
add a comment |
You are currently just calling the name of the fields from the request object. The correct code would be
$model->input = $request->input('input_name');
Take a look here for more info.
You are currently just calling the name of the fields from the request object. The correct code would be
$model->input = $request->input('input_name');
Take a look here for more info.
answered Nov 23 '18 at 11:49
Kyle Wardle
431314
431314
add a comment |
add a comment |
You should try this:
$inputData = $request->all()
users_signedup::create($inputData);
OR
DB::table('users_signedup')->insert($inputData);
add a comment |
You should try this:
$inputData = $request->all()
users_signedup::create($inputData);
OR
DB::table('users_signedup')->insert($inputData);
add a comment |
You should try this:
$inputData = $request->all()
users_signedup::create($inputData);
OR
DB::table('users_signedup')->insert($inputData);
You should try this:
$inputData = $request->all()
users_signedup::create($inputData);
OR
DB::table('users_signedup')->insert($inputData);
answered Nov 23 '18 at 11:57
Saurabh Dhariwal
1,107113
1,107113
add a comment |
add a comment |
<option value="***enter default value***">Choose your Local Government Area</option>
You need to force users to select an option or you can assign a default value.
Also you can make this field in your database nullable or with a default value.
Please check all of your inputs about null options. Your whole code seems fine to me except this.
add a comment |
<option value="***enter default value***">Choose your Local Government Area</option>
You need to force users to select an option or you can assign a default value.
Also you can make this field in your database nullable or with a default value.
Please check all of your inputs about null options. Your whole code seems fine to me except this.
add a comment |
<option value="***enter default value***">Choose your Local Government Area</option>
You need to force users to select an option or you can assign a default value.
Also you can make this field in your database nullable or with a default value.
Please check all of your inputs about null options. Your whole code seems fine to me except this.
<option value="***enter default value***">Choose your Local Government Area</option>
You need to force users to select an option or you can assign a default value.
Also you can make this field in your database nullable or with a default value.
Please check all of your inputs about null options. Your whole code seems fine to me except this.
answered Nov 23 '18 at 12:39
Mesut Uçar
234
234
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445989%2flaravel-is-not-grabbing-all-my-input-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Error is about something else. Your provided data doesn't comply tables constraints.
– Tpojka
Nov 23 '18 at 14:20