Listbox Laravel data
up vote
0
down vote
favorite
Im trying to retrieve data from my database to my listbox
but it's not working this my html code
<select style="width:90%"class="form-control">
@foreach($clients as $client)
<center><option name="client_id" value= {{ $client->id}} >{{ $client->num_mowakil }} | {{$client->nom_mowakil}}</option></center>
@endforeach
</select>
My problem is with the value I get the error:
"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'client_id' cannot be null (SQL: insert into `sujets
And this is my function in the controller to save it I think the problem is from the html code:
public function store(Request $request){
$sujet = new Sujet;
$sujet->client_id=$request->input('client_id');
$sujet->save();
}
mysql laravel
add a comment |
up vote
0
down vote
favorite
Im trying to retrieve data from my database to my listbox
but it's not working this my html code
<select style="width:90%"class="form-control">
@foreach($clients as $client)
<center><option name="client_id" value= {{ $client->id}} >{{ $client->num_mowakil }} | {{$client->nom_mowakil}}</option></center>
@endforeach
</select>
My problem is with the value I get the error:
"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'client_id' cannot be null (SQL: insert into `sujets
And this is my function in the controller to save it I think the problem is from the html code:
public function store(Request $request){
$sujet = new Sujet;
$sujet->client_id=$request->input('client_id');
$sujet->save();
}
mysql laravel
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Im trying to retrieve data from my database to my listbox
but it's not working this my html code
<select style="width:90%"class="form-control">
@foreach($clients as $client)
<center><option name="client_id" value= {{ $client->id}} >{{ $client->num_mowakil }} | {{$client->nom_mowakil}}</option></center>
@endforeach
</select>
My problem is with the value I get the error:
"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'client_id' cannot be null (SQL: insert into `sujets
And this is my function in the controller to save it I think the problem is from the html code:
public function store(Request $request){
$sujet = new Sujet;
$sujet->client_id=$request->input('client_id');
$sujet->save();
}
mysql laravel
Im trying to retrieve data from my database to my listbox
but it's not working this my html code
<select style="width:90%"class="form-control">
@foreach($clients as $client)
<center><option name="client_id" value= {{ $client->id}} >{{ $client->num_mowakil }} | {{$client->nom_mowakil}}</option></center>
@endforeach
</select>
My problem is with the value I get the error:
"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'client_id' cannot be null (SQL: insert into `sujets
And this is my function in the controller to save it I think the problem is from the html code:
public function store(Request $request){
$sujet = new Sujet;
$sujet->client_id=$request->input('client_id');
$sujet->save();
}
mysql laravel
mysql laravel
asked Nov 22 at 15:44
Mehdi El Aissi
94
94
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The "name" attribute must go on the select
statement, not on the option
ones.
For instance:
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
1
thanks it's working!
– Mehdi El Aissi
Nov 22 at 16:34
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The "name" attribute must go on the select
statement, not on the option
ones.
For instance:
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
1
thanks it's working!
– Mehdi El Aissi
Nov 22 at 16:34
add a comment |
up vote
1
down vote
accepted
The "name" attribute must go on the select
statement, not on the option
ones.
For instance:
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
1
thanks it's working!
– Mehdi El Aissi
Nov 22 at 16:34
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The "name" attribute must go on the select
statement, not on the option
ones.
For instance:
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
The "name" attribute must go on the select
statement, not on the option
ones.
For instance:
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
answered Nov 22 at 15:48
vivoconunxino
2,77711839
2,77711839
1
thanks it's working!
– Mehdi El Aissi
Nov 22 at 16:34
add a comment |
1
thanks it's working!
– Mehdi El Aissi
Nov 22 at 16:34
1
1
thanks it's working!
– Mehdi El Aissi
Nov 22 at 16:34
thanks it's working!
– Mehdi El Aissi
Nov 22 at 16:34
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%2f53434375%2flistbox-laravel-data%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