SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Location
    London, UK
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    zend framework cant get session variable to display in form

    I am getting familliar with zend framework and I have a form which data is saved in a database and then also stored in a zend session so that it can be retrieved and used in another controller.

    The thing is when I do a

    Code:
    print_r(print_r($this->SessionGroupLoans->data);
    where data is the variable that holds the form entries from the provious form as an array,
    I see the session data that has been stored ok

    Code:
    Array ( [id] => GH4C9C2EAB6A82D [groups_id] => GH4C8801A07291B [loan_amount] => 7000.00 [loan_start] => 2010-09-01 [grace_period] => Yes [payment_start] => 2010-09-06 [loan_duration] => 13 [loan_end] => 1970-01-01 [group_daily_payment] => 120.17 [loan_cycle_number] => 1 [loan_purpose] => To Be Supplied [commitment_fee] => 70.00 [repayment_frequency] => Daily [interest_payable] => 210 [loan_amount_payable] => 7000.00 [total_amount_payable] => 7210.00 [amount_remitted] => 7140.00 [date_created] => 2010-09-24 05:52:59 )
    However when I do
    Code:
           
     // Add the Group Loan Id element
            $groups_loan_id = $this->createElement('Select', GroupsLoanId);
            $groups_loan_id->setLabel('Select Group Loan ID:')
                    ->setAttrib('size', '1')
                    ->addValidator('StringLength', FALSE, array(3, 50))
                    ->setRequired(TRUE);
    
                    foreach($groupsloans as $u)
                        $groups_loan_id->addMultiOption($u->id,$u->id);
    
                    if (isset ($this->SessionGroupLoans->data->groups_id))
                    {
                        $groups_loan_id->setValue($this->SessionGroupLoans->data->groups_loan_id);
                    }
    the group id is not populated in the form This is holding me back big time. Help if you can anyboby.
    Prov. 13:20 - He that walketh with wise men shall be wise: but a
    companion of fools shall be destroyed

  2. #2
    SitePoint Enthusiast descarte's Avatar
    Join Date
    Nov 2006
    Location
    melbourne
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems to be an array syntax rather than zend framework. What if you do this... does it work?

    PHP Code:
    $data $this->SessionGroupLoans->data;
    if (isset (
    $data['groups_id'])) {               
      
    $groups_loan_id->setValue($data['groups_loan_id']);


  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Location
    London, UK
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks descarte that did it.
    Prov. 13:20 - He that walketh with wise men shall be wise: but a
    companion of fools shall be destroyed


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •