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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:02:43+00:00 2026-06-09T11:02:43+00:00

hi all im trying to load information from a table into a dropdown box.

  • 0

hi all im trying to load information from a table into a dropdown box. I’m trying to load account_id from my accounts_users table which contains – id, accounts_id, user_id into a dropdown box.

account_id should only show when the id from the users table = user_id from the accounts_users table. at the moment the dropbox is only loading the id from the accounts_users table.

here is my add function

function add() {
    $this->set('title_for_layout', 'Please Enter Your Temaplate Details');
    $this->set('stylesheet_used', 'style');
    $this->set('image_used', 'eBOXLogo.jpg');  
    $accounts=$this->User->AccountsUser->find('list', array('conditions' => array('user_id' => $this->Auth->user('id'))));
    debug($accounts);
    if($this->request->is('post')){
      $this->Template->create();

  if ($this->Template->save($this->request->data)) {
    $this->Session->setFlash('The template has been saved');
    $this->redirect( array('controller' => 'Fields','action' => 'add'));
  } else {
    $this->Session->setFlash('The template could not be saved. Please, try again.');
  }
}

$this->set('accounts', $accounts); 

}

and here is the add view

<?php
echo $this->Form->create('Template', array('action'=>'add'));
echo $this->Form->input('name',array('label'=>'Template Name: '));
echo $this->Form->input('account_id',array('label'=>'Business: ', 'type' => 'select', 'options' => $accounts));
echo $this->Form->input('description',array('label'=>'Short Description Of Template: '));
echo $this->Form->end('Click Here To Submit Template');
?>

the debug outputs

app\Controller\TemplatesController.php (line 20)
array(
(int) 3 => ‘3’
)

the user in the accounts_users table only has 1 entry with id=3, account_id=10 and user_id=14

  • 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-09T11:02:45+00:00Added an answer on June 9, 2026 at 11:02 am
    $accounts=$this->User->AccountsUser->find('list', array('conditions' => array('user_id' => $this->Auth->user('id'))));
    

    should be:

    $accounts=$this->User->AccountsUser->find('list', array('fields'=>array('id','account_id'),'conditions' => array('user_id' => $this->Auth->user('id'))));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to insert a user id from devise into another table which
Trying to load a small .txt file into mysql but get all my data
I'm trying to load text of all divs that have a particular class into
All, I'm trying to load some content into a fancybox. I'd like to load
I'm trying to load image from a plist to a custom cell. It all
I am trying to extract information from an XML file into an object using
I am trying to load all my Neo4j DB to the RAM so querying
Afternoon all, Using the code below I'm trying to load what is render by
I'm trying to get all controls in a winform disabled at the Load event.
I have a WPF program with two listviews which display information from two different

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.