You need to read up on the manual.


On Dec 27, 7:14 am, mona <poojapinj...@gmail.com> wrote:
> It can't solve my problem i m sending you my code can you tell me
> where i m making mistake plz correct it if it is possible
> this i my entries controller  and i want data in drop down box in add
> and edit pages from table name section
> <?php
> class EntriesController extends AppController {
>
>         var $name = 'Entries';
>         var $helpers = array('Html','Form');
>
>         function index()
>         {
>
>                 $this->Entry->recursive = 1;
>                 $this->set('entries', $this->Entry->findAll());
>
>         }
>         function view($id = null)
>         {
>                 if (!$id)
>                  {
>                         $this->Session->setFlash('Invalid id for Entry.');
>                         $this->redirect('/entries/index');
>                   }
>                 $this->set('entry', $this->Entry->read(null, $id));
>
>         }
>
>         function add()
>         {
>                 if (empty($this->data))
>                  {
>                         $this->render();
>                  }
>                  else
>                  {
>                         //$this->cleanUpFields();
>
>                         if ($this->Entry->save($this->data))
>                                 {
>
>                                         $this->Session->setFlash('The Entry 
> has been saved');
>                                         $this->redirect('/entries/index');
>                                 }
>                         else
>                                  {
>                                         $this->Session->setFlash('Please 
> correct errors below.');
>                                 }
>                  }
>         }
>         function edit($id = null)
>          {
>                 if (empty($this->data))
>                  {
>                         if (!$id)
>                          {
>                                 $this->Session->setFlash('Invalid id for 
> Entry');
>                                 $this->redirect('/entries/index');
>                         }
>                         $this->data = $this->Entry->read(null, $id);
>                 } else
>                 {
>                         //$this->cleanUpFields();
>                         if ($this->Entry->save($this->data))
>                                  {
>                                         $this->Session->setFlash('The Entry 
> has been saved');
>                                         $this->redirect('/entries/index');
>                                  }
>                    else
>                                 {
>                                         $this->Session->setFlash('Please 
> correct errors below.');
>                                 }
>                 }
>         }
> function delete($id = null) {
>                 if (!$id) {
>                         $this->Session->setFlash('Invalid id for Entry');
>                         $this->redirect('/entries/index');
>                 }
>                 if ($this->Entry->del($id)) {
>                         $this->Session->setFlash('Record deleted 
> successfully');
>                         $this->redirect('/entries/index');
>                 }
>         }
>
> }
>
> ?>
> my model of entries is
> <?php
> class Entry extends AppModel {
>
>         var $name = 'Entry';
>         var $belongsTo=array('Section'=>array(
>         'className'=>'Section'
>         ),
>         'Submenu'=>array('className'=>'Submenu')
>         );
>
> }
>
> ?>
> and my add view is here i want drop down box and fetch data from
> section table in Section field i m using cake php 1.2
> <h2>New Entry</h2>
> <?php echo $form->create('Entry',array('action' => 'add','type' =>
> 'file'));?>
> <div class="optional">
>     <?php echo $form->input('Section', array('options' => array
> ('Announcements','The Venue','About Melbourne')),array('error' =>
> 'false','value' => array(1,2,3) )); ?>
> </div>
> <div class="optional">
>         <?php echo $form->input('Submenu', array('options' => array
> (1,2,3,4,5)),array('error' => false)); ?>
> </div>
> <div class="optional">
> <?php echo $form->input('Listitem',array('label' => 'Listitem'),array
> ('error' => false));?>
> </div>
> <div class="optional">
> <?php echo $form->input('Detail',array('label' => 'Detail'),array
> ('error' => false));?>
> </div>
> <!--<div class="optional">
> <?php echo $form->labelTag('Entry/file', 'Attachment');?>
> <?php echo $html->file('Entry/file');?>
> <?php echo $html->tagErrorMsg('Entry/file', 'Please enter a file.');?>
> --></div>
> <div class="submit">
>         <?php echo $form->submit('Add');?>
> </div>
> </form>
> <ul class="actions">
> <li><?php echo $html->link('Home', '/entries/index')?></li>
> </ul>
>
> and my edit view is
> <h2>Edit Entry</h2>
> <?php echo $form->create('Entry',array('action' => 'edit'));?>
> <div class="optional">
> /* here instead of text box i wan't data in dropdown box */
> <?php echo $form->input('Section.section',array('label'
> =>'Section','size'=>'30'
> ,'type'=>'text'));?>
> </div>
> <div class="optional">
> <?php echo $form->input('Submenu.submenu',array('label'
> =>'Submenu','size'=>'30'
> ,'type'=>'text'));?>
> </div>
> <div class="optional">
> <?php echo $form->input('Entry.Listitem',array('label'
> =>'Listitem','size'=>'30'
> ,'type'=>'text'));?>
> </div>
> <div class="optional">
>         <?php echo $form->input('Entry.Detail',array('label'
> =>'Detail','size'=>'30'
> ));?>
>
> </div>
> <?php echo $form->hidden('entry/id')?>
> <div class="submit">
>         <?php echo $form->submit('Save');?>
> </div>
> </form>
> <ul class="actions">
> <li><?php echo $html->link('Delete','/entries/delete/' . $form->value
> ('Entry/id'), null, 'Are you sure you want to delete: id ' . 
> $form->value('Entry/id'));?>
>
> <li><?php echo $html->link('Back', '/entries/index')?></li>
> </ul>
>
> Please if you help me it will be great help for me can you tell me how
> i can remove sql log table from my pages in cakephp 1.2
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to