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 7688019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:49:49+00:00 2026-05-31T19:49:49+00:00

I am very new to symfony. In other languages like java and others I

  • 0

I am very new to symfony. In other languages like java and others I can use request.getParameter('parmeter name') to get the value.

Is there anything similar that we can do with symfony2.
I have seen some examples but none is working for me. Suppose I have a form field with the name username. In the form action I tried to use something like this:

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

I have also tried

$username = $request->getParameter('username');

and

$username=$request->request->getParameter('username');

But none of the options is working.However following worked fine:

foreach($request->request->all() as $req){
    print_r($req['username']);
}

Where am I doing wrong in using getParameter() method. Any help will be appreciated.

  • 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-05-31T19:49:50+00:00Added an answer on May 31, 2026 at 7:49 pm

    The naming is not all that intuitive:

    use Symfony\Component\HttpFoundation\Request;
    
    public function updateAction(Request $request)
    {
        // $_GET parameters
        $request->query->get('name');
    
        // $_POST parameters
        $request->request->get('name');
    
        // As of 6.3 Posted or json content
        $request->getPayload()->get('name');
    

    Update Nov 2021: $request->get(‘name’) has been deprecated in 5.4 and will be private as of 6.0. It’s usage has been discouraged for quite some time.

    Update May 2023: As of 6.3, a getPayload method has been added for post/json data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(very new to JavaScript jQuery) Can an if statement contain a collection of other
Very new to maven. I have a pom file that I can use to
Very new to iOS coding. I'd like to be able to display a modal
Im very new to C programing, but have limited experience with Python, Java, and
Im very new to Objective-C and am currently learning how to use Xcode and
Very new to Jquery and wondering if anyone can help me with the following
Im very new to Oracle so can anyone please explain about sys and system
I am very new to Symfony 1.4 and basically know just how to create
Very new to Java and Swing, and I have been playing with a swing
Im very new to java (mainly duel with embedded only) Im writing a simple

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.