Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8115409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:28:37+00:00 2026-06-06T03:28:37+00:00

I have a very simple question, How can I get the POST values from

  • 0

I have a very simple question, How can I get the POST values from get->Request();

public function emptytrashAction(){
    $request = $this->getRequest();
    $portfolio_id = $_POST["test"];
}

I dont want to use the $_POST variable and the form I submit just contain this hidden field test. The form is,

 <form name="empt_trash" action="{{ path('MunichInnovationGroupPatentBundle_portfolio_emptytrash') }}" method="post" >
    <input type="hidden" name="test" value={{ selected_portfolio.id }}>
    <input class="button3 tooltip" name = "submit" type="submit" value="Empty"></a>
 </form>

How can I get the value of the hidden field without using $_POST?

Edit

If a method use both GET and POST requests, For the Post request I check in my code like this

            if ($request->getMethod() == 'POST')

but it is not the symfony2 way then what is the proper way to check for the POST request?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:28:38+00:00Added an answer on June 6, 2026 at 3:28 am

    As simple as :

    $request  = $this->getRequest();
    $postData = $request->request->get('test');
    

    Note: This solution is only valid for Symfony <2.4 version. For 2.4 is deprecated and removed for 3.0.

    The new code for obtain the request should be:

    $request = $this->container->get('request_stack')->getCurrentRequest();
    $postData = $request->request->get('test');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a very simple question I can't seem to get my head around.
This might be a very simple question, but I can't get it working. All
I have a very simple question for which I can't seem to find an
i have a very simple question, actually this is not the question, this is
This is a very simple question yet I have little knowledge in Linux and
Ok this is more of general technology/approach question. We have a very simple web
This is probably a very simple question. I am new to Rails and have
I have a very simple (rather stupid) question, I hope someone can clear my
Very simple question I hope. I have the usual <select> box like this <select
Very simple and stupid question. i have a page class public partial class ProtectWayItem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.