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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:32:06+00:00 2026-06-15T08:32:06+00:00

after some questions about how to resolve one of my problem (http://stackoverflow.com/questions/13609611/using-several-modules-in-the-same-view) I have

  • 0

after some questions about how to resolve one of my problem (http://stackoverflow.com/questions/13609611/using-several-modules-in-the-same-view) I have another one.

I made a form in a view helper because I needed to access the result of this form in another controller.

So here is my view helper called QuickSearch.php

class Zend_View_Helper_QuickSearch extends Zend_View_Helper_Abstract
{
    public function quickSearch()
    {
    $form = new Application_Form_QuickSearchForm();
    return $form;
    }
}

calling QuickSearchForm.php

class Application_Form_QuickSearchForm extends Zend_Form

{

public function init()
{
    $this->setMethod('post');
    $this->setAction('/search/quicksearch');
    $this->addElement('text', 'searchLocation', array(
            'label' => 'Location:',
            'required' => true,
            'filters' => array('StringToUpper')
            ));
    //[some other elements]
    $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Search',
    ));
}

In my main page view, I call the viewhelper with

echo $this->quickSearch();

Which works, since I have access to my form.

When I submit my form, the /search/quicksearch is called as it’s supposed to be but when I try to access the data from the form, it seems that it’s empty.

Here is my Search controller (SearchController.php)

class SearchController extends Zend_Controller_Action
{

public function init()
{
    /* Initialize action controller here */
}

public function indexAction()
{
    // action body
}

public function quicksearchAction()
{
    $form = new Application_Form_QuickSearchForm();

    if ($this->getRequest()->isPost())
    {
        echo("post");
        $data = $form->getValues();
        echo($data['searchLocation']);
    }

}

}

I put the echo(“post”) to see if I was getting a POST request, and every time it works.
the only thing that display is the ‘post’ and the second echo doesn’t display anything.

I don’t know what I didn’t understand in the way to get the form’s data from another controller.

Can someone help me with this ? I just don’t know why it doesn’t work.

  • 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-15T08:32:07+00:00Added an answer on June 15, 2026 at 8:32 am

    You need to pass the post data to the form object. The typical way to do this is by calling the isValid() method of the form (which also validates the submitted data):

    public function quicksearchAction()
    {
        $form = new Application_Form_QuickSearchForm();
    
        if ($this->getRequest()->isPost()) {
            if ($form->isValid($this->getRequest()->getPost()) {
                $data = $form->getValues();
                echo $data['searchLocation'];
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I came across couple of questions about OCL expressions. After reading some university slides
This might seem like a silly question, but after asking some questions on stackoverflow
After reading some questions/answers about activity and process lifecycle. I suppose I understand the
After reading this article . I have some questions about NTLM Authentication. When I
After reading some questions and answers about enum I don't find it really useful...
I have some questions about the affects of using concrete classes and interfaces. Say
I saw many questions about this, and tried to solve the problem, but after
I have some questions about the usage of the close() method when using Java
some questions about records in Delphi: As records are almost like classes, why not
I want to ask some questions about the JSP and JSON file. I have

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.