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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:15:45+00:00 2026-06-06T05:15:45+00:00

I have made a custom form in a module where I have used a

  • 0

I have made a custom form in a module where I have used a select list & I am trying to populate that with the name of OG name.

I wrote a function for db_query() & that is giving me exact out put but I am not able to populate that in from select.

Function for db_query():-

function taskform_project_select(){
    $options=array();
    $project_query = "SELECT node.title FROM {node}, {og} WHERE node.nid = og.nid";
    $project_details = db_query($project_query);
    while($project_title = db_fetch_object($project_details)){
        $options = $project_title->title;       
        dpm($options);
    }
    return $options;
}

Code in Form:-

  $options = taskform_project_select();
  $form['edproject'] = array(
    '#type' => 'select', 
    '#title' => t('Project'),    
    '#options' => $options,
    '#description' => t('Choose a project'),
    '#prefix' => '<td>',
    '#suffix' => '</td>',
  );

Thanks 🙂

  • 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-06T05:15:47+00:00Added an answer on June 6, 2026 at 5:15 am

    Correct syntax is:

    $options[] = $project_title->title;
    

    ..with square brackets.

    $options[$project_title->title] = $project_title->title;
    

    provides a meaningful key value to the result. You could also retrieve the nid and use that as the key.

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

Sidebar

Related Questions

Lets Suppose that I have made a custom authentication module that inherits IHttpModule class.
I have a custom Form I've made that extends the Doctrine base forms for
I am new to ZF.i have made a function that basically make a Form
I have made my custom module in magento, in which I have set discount
I have made a custom java program to output a license and am trying
I have made a custom node type for event registration. I have used themes
I have a form with a few bound fields and a few 'custom made'
I have made a custom module and it works fine till I start working
I have a custom form built within Outlook that sends an email notification any
I have a custom edit form made for ASPxGridView but have a big problem

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.