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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:16:59+00:00 2026-06-17T23:16:59+00:00

I am using Zend_Form (full library on include_path) but not using MVC . $_POST

  • 0

I am using Zend_Form (full library on include_path) but not using MVC. $_POST values are as expected, but $form->getValues() returns null for key that contain correct strings in $_POST. I expected $form->getValues() to return a valid string for ‘fullname’ key. Here is the form:

class MyForm extends Zend_Form {

    public function init() {
        $this->setName('myform')
            ->setAction($_SERVER['PHP_SELF'])
            ->setMethod('post');

        $fullname = $this->createElement('text', 'fullname')
            ->setLabel('What is your name?');

        $this->addElement($fullname);
        $this->addElement('submit', 'submit');
    }

}

Here is the HTML that is generated for the form:

<form id="myform" name="myform" enctype="application/x-www-form-urlencoded" action="/classes_test/index.php" method="post">
    <dl class="zend_form">
    <dt id="fullname-label">
        <label for="fullname" class="optional">What is your name?</label>
    </dt>
    <dd id="fullname-element">
        <input type="text" name="fullname" id="fullname" value="">
    </dd>
    <dt id="submit-label">&#160;
    </dt>
    <dd id="submit-element">
        <input type="submit" name="submit" id="submit" value="submit">
    </dd>
    </dl>
</form>

Here’s the processing:

$request = new Zend_Controller_Request_Http();
$form = new MyForm;
$form->setView(new Zend_View);
if ($request->isPost()) {
    var_dump($_POST);
    $data = $form->getValues();
    var_dump($data);
    if ($form->isValid($request->getPost()) {
        ...
    }
}

Here is a var_dump of $_POST:

array
  'fullname' => string 'My Name' (length=7)
  'submit' => string 'submit' (length=6)

Here is a var_dump of $data:

array
  'fullname' => null

Why is ‘fullname’ null?

  • 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-17T23:17:00+00:00Added an answer on June 17, 2026 at 11:17 pm

    Zend_Form doesn’t access data from $_POST directly, you have to pass the data in. One of the ways this is done is by the isValid() call. So the answer to your question is – fullname is null because there isn’t any data in the form object yet.

    If you try this instead:

    if ($request->isPost()) {
        var_dump($_POST);
    
        if ($form->isValid($request->getPost()) {
            $data = $form->getValues();
            var_dump($data);
        }
    }
    

    you will get the result you are expecting.

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

Sidebar

Related Questions

I'm using Zend Framework and Zend_Form to render my form. But as I found
I'm trying to build a form using the Zend_Form component, but the number of
I am having problems getting validation to work for a form built using Zend_Form.
i am using a zend model which returns me an object in form of
Using Zend_Form, how would I create form elements like this <input type=text name=element[1] value=/>
I'm using Zend_Form from Zend Framework 1.10.6 to render a html form. In this
I'm using zend form in a non-zend project and I'm able to access Zend_Form
I'm using Zend_Form with a ViewScript decorator. This form will be for managing two
I'm trying to configure a form for Zend_Form using Zend_Config_Ini, and wish to set
I am using zend_form (part of Zend Framwork) to create a form and found

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.