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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:34:28+00:00 2026-05-27T23:34:28+00:00

I have a form with many textfields ,selects in which one select and one

  • 0

I have a form with many textfields ,selects in which one select and one multiselect has same data fetched from database by following code:

    //Form1
    $form_project=new Project_Form_AddProject();
    //Form2
    $form_project_type=new Project_Form_ProjectType();

    //add values to dropdown companies
    $object_company=new Project_Model_DbTable_Company();
    $list_companies=$object_company->fetchAll();
    foreach ($list_companies as $clist) :
        $name = $clist['company_name'];

        $dropdown_list[$clist['company_id']] = $clist['company_name'];

    endforeach;
    foreach ($dropdown_list as $key => $value):
        //Line A
        $form_project->customer->addMultiOptions($dropdown_list);//customer is select
        //Line B
        $form_project_type->partner->addMultiOptions($dropdown_list);//partner is multiselect
    endforeach;

Here class Project_Model_DbTable_Company maps to a database table named company which contains 328 rows.Now When:
I comment line B everything is going fine but when I uncomment line B error occurs saying as

 Maximum execution time of 30 seconds exceeded in ZendFramework-1.11.11\\Zend\Form.php on line 3011

Why is this problem occuring??Is it due to excessive data that I am going to put in two dropdowns on same form?Plz suggest me.Thanks in advance.

  • 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-27T23:34:29+00:00Added an answer on May 27, 2026 at 11:34 pm

    The problem is in your second foreach loop. These lines

    foreach ($dropdown_list as $key => $value):
        //Line A
        $form_project->customer->addMultiOptions($dropdown_list);//customer is select
        //Line B
        $form_project_type->partner->addMultiOptions($dropdown_list);//partner is multiselect
    endforeach;
    

    are adding 328 options 328 times. the addMultiOptions() method accepts an array and iterates through it. Your code should be changed to:-

    //Line A
    $form_project->customer->addMultiOptions($dropdown_list);//customer is select
    //Line B
    $form_project_type->partner->addMultiOptions($dropdown_list);//partner is multiselect
    

    That should allow your code to run within the max_execution_time limit although I still think it’s a bad idea to have 328 options in a drop down. I’m sure a bit of thought on your part would discover a much more elegant and user friendly alternative.

    Also try changing your foreach blocks to look like this:-

    foreach ($list_companies as $clist){
        $name = $clist['company_name'];
        $dropdown_list[$clist['company_id']] = $clist['company_name'];
    }
    

    You’ll find your code is much more readable.

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

Sidebar

Related Questions

I have WPF Form which has many buttons with the same code. Appearance of
I have a pretty big data entry form which has many text fields ,
I have a form that has many long-methods. My quest is: What is the
I have a form which have many check boxes in it. User will check
I have a form MainForm which is a Windows Forms form that contains many
I have a complex form that has a static section and one that can
I have a wicket form which contains many TextField input components. There's a Validator
I have a form that has many checkboxes (too many for it to make
I have a form that has many dynamically generated checkboxes. At runtime, how can
I have a form on the page. It has too many things like checkboxes

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.