2

Here is my Symfony controller:

class MyPageController extends Controller
{
    public function indexAction(Request $request)
    {
        $postData = $request->request->get('manage');
        return new Response('<html><body>Post: '.$postData.'!</body></html>');
    }
}

Here is my HTML:

<form action="/..." method="POST" id="entity">
    <input type="text" value="This is the value" id="manage" />
    <input type="submit" class="button" value="Submit" />
</form>

$postData is always empty.

I've tryed also:

$postData = $request->request->get('entity');

$postData['manage'] is empty too!

Can somebody help me?

1 Answer 1

8

i guess it's not a symfony issue, just html, your input needs name attribute so it can be included in POST

<form action="/..." method="POST" id="entity">
<input type="text" value="This is the value" name="manage" />
<input type="submit" class="button" value="Submit" />
</form>
Sign up to request clarification or add additional context in comments.

1 Comment

Yep, that's it! I've made a stupid mistake - entered the "id" instead on "name" attribute...

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.