Thank you for reply. If you can look my code, I will be greatly
appreciated.
I did use goole to search how to generate a list. However, my
generateMenuList just return an empty list. The menu button doesn't
show any value, It is supposed to have 1, 2, 3, 4. By the way, my
table only has two fields: setting and value,, no id field.
Here is in my settings_controllers.php
//I put generateMenuList() in settings_controllers.php
function generateMenuList()
{
$data = $this->Setting->findAll();
$return = array();
foreach ($data as $menu)
{
$return[$menu['Setting']['value'] ]=$menu['Setting']
['value'];
}
print_r($return);
return $return;
}
function edit($setting){
$data = $this->Setting->findAll(); //select all
$this ->set('settings_values',$data);//set fo finding values
$this->set('Menu', $this->Setting->generateMenuList());
if (empty($this->data['Setting'])){
$this->Setting->setting = $setting;
$this->data = $this->Setting->read();
$this->set('setting',
$this->data['Setting']['setting']);
} else {
if($this->Setting->save($this->data['Setting'])){
$this->flash('Your setting has been
updated.','/settings/');
}
}
}
here is my edit.thml
<h1>Edit Setting</h1>
<form action="<?php echo $html->url('/settings/edit/'.$setting)?>"
method="post">
<?php
?>
<pre>
<?php print_r($settings_values);
print_r($Menu);
?>
pre>
<p>
Section:
<?php echo $html->textarea('Setting/setting', Array("disabled"
=> "disabled"));?>
</p>
<p>
Position:
<?php echo $html->selectTag('Setting/setting',
$Menu,
null,
array('multiple' => 'multiple', 'size' => sizeof($Menu)
+1));
?>
<p>
<?php echo $html->submit('Save'); ?>
</p>
</form>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---