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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:33:53+00:00 2026-05-29T11:33:53+00:00

I ll reframe my question based on some research I have done? I need

  • 0

I ll reframe my question based on some research I have done?

I need to store lot of errors separately like $_SESSION[‘client_error’],$_SESSION[‘state_error’] etc.
According to zend documentation do I have to store it like this for each error?

$client_error = new Zend_Session_Namespace(''client_error);
$state_error = new Zend_Session_Namespace('state_erro'); and so on?

This is my code in the controller.
I am storing it as
$this->view->state_error_message=$state_error;

After I echo $this->state_error in the view I want to unset it.

Ok here are few more things I tried:
In the controller in policyInfoAction:

    session_start();
$error_message = new Zend_Session_Namespace('error_message');
$error_message="TEST";
$this->view->error_message=$error_message;
$this->_redirect('/pdp/client-info/');

In the view in client-info:

session_start();
<?php echo $this->error_message; ?>

This returns nothing.

Ok this is my updated code:

    public function clientInfoAction()
        {

            $errors = new Zend_Session_Namespace('errors');
            // get the error arrays
            $client_errors = (isset($errors->client_error)) ? $errors->client_error : array();
            $state_errors  = (isset($errors->state_error)) ? $errors->state_error : array();
            unset($errors->client_error, $errors->state_error); // delete from the session

            // assign the values to the view
            $this->view->client_errors = $client_errors;
            $this->view->state_errors  = $state_errors;
}


    public function policyInfoAction()
    {

         if (count($arrErrors) > 0)
         {

            // The error array had something in it. There was an error.
            $strError="";

            foreach ($arrErrors as $error)
            {
            $strError="";
            $errors->client_error = array();
            $errors->state_error  = array();


            foreach ($arrErrors as $error)
            {
                $strError .= $error;
                // to add errors to each type:
                $errors->client_error['client_error'] = $strError;
                $errors->client_error[] = $strError;
                $this->_redirect('/pdp/client-info/');


            }
               }
}

When i echo $this->client_errors I get ‘Array’

  • 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-29T11:33:56+00:00Added an answer on May 29, 2026 at 11:33 am

    Here is some advice and suggestions that can hopefully get you on the right track.

    First, when using Zend_Session and/or Zend_Session_Namespace, you never want to use PHP’s session_start() function1. If you start a session with session_start(), and then try to use Zend_Session, it will throw an exception that another session already exists.

    Therefore, remove all session_start() calls from your Zend Framework application.

    Second, you mentioned you had a lot of messages you need to store, so this may not be the right thing for you, but see the FlashMessenger action helper. This allows you to set a message in a controller, and then access it on the next page request. The messages only live for one page hop, so after the next page load, they are deleted. You can store many messages with the FlashMessenger, but your access to them is not very controlled. You could use multiple flash messengers each in differen namespaces also.

    To solve your problem in particular, you could just do something like this:

    // in controller that is validating
    $errors = new Zend_Session_Namespace('errors');
    $errors->client_error = array();
    $errors->state_error  = array();
    
    // to add errors to each type:
    $errors->client_error['some_error'] = 'You had some error, please try again.';
    $errors->client_error['other_error'] = 'Other error occurred.';
    $errors->client_error[] = 'Other error, not using a named key';
    
    $errors->state_error[] = MY_STATE_PARSING_0;
    

    What is happening here is we are getting a session namespace called errors creating new properties for client_error and state_error that are both arrays. You don’t technically have to use multiple Zend_Session_Namespaces.

    Then to clear the messages on the next page load, you can do this:

    // from controller again, on the next page load
    $errors = new Zend_Session_Namespace('errors');
    
    // get the error arrays
    $client_errors = (isset($errors->client_error)) ? $errors->client_error : array();
    $state_errors  = (isset($errors->state_error)) ? $errors->state_error : array();
    
    unset($errors->client_error, $errors->state_error); // delete from the session
    
    // assign the values to the view
    $this->view->client_errors = $client_errors;
    $this->view->state_errors  = $state_errors;
    

    See also the source code for Zend_Controller_Action_Helper_FlashMessenger which can give you some idea on managing data in session namespaces.

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

Sidebar

Related Questions

I think I shall reframe my question from Where should you use BlockingQueue Implementations
REFRASE QUESTION : I have 6 selects. When I select value from select1 I
I have reframed my Question: I have a drop down box which is populated
Wanted some help with a problem with mapkit I am facing. Should be a
I have a simple table for reference page: id name description image In reference.php,
I have a bit of file processing to do in Automake and can't figure
I need to access a value within a form and an iframe from the
I have a query that has a very costly INDEX SEEK operation in the
I need to make a custom dialog with 4 options but as far as
I'm trying to write a function to add color to a table based on

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.