I am sorry I cannot solve this simple problem. I have a table called
settings with 2 fields: setting and value.I made a menu drop list from
field value (Thanks Mikee), now I have this edit.thtml, I'd like to
update value by select a value from menu drop list. then click save,
the field setting with its value will be saved. However, my code
doesn't really save, I think I didn't pass the value to be saved. Can
anyone help me on this? Bellow is my code:
#############
edit.thtml
##############
<table>
<tr>
       <th>Setting</th>
       <th>Value</th>
</tr>
<tr>
       <td><?php echo $setting['Setting']['setting'];?>
       </td>
       <td><form method="post" action="<?php echo $html->url('/
settings/
edit')?>">
               <?php   echo $html->selectTag('setting/value',
$menu);  ?>
               <?php echo $html->submit('Save') ?>
               </form>
       </td>
</tr>
</table>
################################################
edit function in settings_controller.php
################################################
function edit($setting=null){
               $this->Setting->setting = $setting;
       $this->set('setting', $this->Setting->read()); //editting
values of fileds setting and value
               $this->set('menu', $this->Setting->generateList(null,
"value ASC",
null,'{n}.Setting.setting','{n}.Setting.value')); //generate dropdown
menu list

               if (empty($this->data['Setting'])){
                       $this->Setting->setting = $setting;
                       $this->data = $this->Setting->read();

               }else{
                       if ($this->Setting->save($this-
>data['Setting'])){
           $this->flash('Your setting has been updated.','/
settings');
                       }
               }
       }


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to