I am submitting form to /add route BUT when i click on submit button it gives this error Using : Larvel 5
{ SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '$name' for key 'name' (SQL: insert into
projects
(id
,name
,money
,anything
) values (, $name, 20, asfsf)) }
FORM :
{!! Form::open(array('url' => 'add')) !!}
{!! Form::text('name', '[email protected]') !!}
{!! Form::submit('Click Me!')!}
{!! Form::close() !!}
Routes.php
Route::post('add', function () {
$test = Input::get('name');
echo $test;
});
PS: I want to echo the input field value but it gives the above mentioned error.
projects
? – Jeff Lambertadd
route? – Alexey Mezenin'$name'
somewhere, where you should type just$name
. – Laerte[email protected]
as output. I've created view and copy-pasted your form there. Also, I've copy-pasted your route. Works fine. – Alexey Mezenin