3

I'm really not sure why my controller is not receiving the attribute and value input! Here's my system.

View

<form method="POST" action="create/attribute">
    {{ csrf_field() }}
    <div class="12u$">

      <input type="text" id="attribute" >
      <input type="text" id="value" >
    </div>

      <div class="12u$">
        <ul class="actions">
          <li><input type="submit" value="Submit" class="special" /></li>
          <li><input type="reset" value="Reset" /></li>
        </ul>
      </div>
    </form>

Controller

public function store()
    {
        dd(request()->all());
}

route

Route::post('/stimulus/create/attribute', 'Attributes@store');

When I press submit I receive

    array:1 [▼
  "_token" => "K4TSq9lVQq8etkH8lPDxfUJ8g9oF58wm2kJ2pwlz"
]

But nothing else. I'm really unsure what I'm missing here!

0

1 Answer 1

8

You are missing the name attribute on both of the input element inside the form

   <input type="text" name="attribute" id="attribute" /> 
                       ^
   <input type="text" name ="value" id="value" />
                       ^

and then fix the store function inside controller

public function store(Request $request) 
{
    dd(request()->all());
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for this, I don't know why sometimes I forget this...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.