Hello all..
I have a problem given below:

I made a element: search.thtml

where there is some form elements. In that there is religion select
box. I have a table called religions, where all religions name is
stored. I made also searches table, so every time user searches, it
will be stored in 'searches' table with its user_id.

I have given relationship between 'searches' and 'religions' table
given below:

var $belongsTo = array(
                        'Search' => array('className' => 'Search',
                                                                'foreignKey' => 
'religion_id',
                                                                'conditions' => 
'',
                                                                'fields' => '',
                                                                'order' => '',
                                                                'counterCache' 
=> '')
                                        );

In my search() action of I write:

$this->set('religions',$this->Search->Religion->find('list',array
('fields'=>array('name'))));

so that I can fill my 'religion'  select box. But the problem is as I
use search.thtml element for search form
If I write
<?php echo $form->input('religion_id',array('label'=>''));?>
it will not fill the selcet box as I think cakephp is smart enough and
it will automatically take the values and create select dropdown( and
it does in other cases.. :)  but here it doesn't :(  ).

and if I write like this:3
<?php echo $form->input('religion_id',array('label'=>'','options' =>
array($religions)));?>

It gives me error: cant find $religions as it used here in  element..

so how to fill the select box in element???

waiting for reply..

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to