Cake can automatically add your selects so you do not need to manually do
that.

 

In controller:

 

$departments = $this->Employee->Department->find('list');//get list of all
the departments

$this->set(compact('departments'));

 

Then in the form echo $this->Form->input('departments');

 

Read the book or API classes as there are options to set empty value => Find
in the List, 'type',  $options. Whole slew of options available in
FormHelper

 

 

From: Taffarel de Lima [mailto:[email protected]] 
Sent: Tuesday, December 28, 2010 4:18 PM
To: [email protected]
Subject: Re: Can we mix plain php,html and cakephp?

 

i don't see anything wrong with that. if there some wrong, someone can
explain

2010/12/28 poor-grammar <[email protected]>

hello, i am new to cakephp, and still going thru the manual...

Is there a way to mix cakephp with plain php and HTML.... i mean
something like this in the code....

----------------------------------------------------------------------------
--------
<?php
echo $this->Form->create('Employee',array('action'=>'edit'));
   echo $this->Form->input('id',array('type'=>'hidden'));
   echo $this->Form->input('emp_name');
   echo $this->Form->input('emp_email');
   echo $this->Form->input('emp_phone');
   echo $this->Form->input('emp_address');
   echo $this->Form->input('emp_joindate');
  echo $this->Form->input('emp_dob');
 ?>
<select id="Dept_Name" name="data[Employee][dept_id]">
<option value="">find in the list</option>
<option value="0">finance</option>
<option value="1">marketing</option>
<option value="2">reserve</option>
<option value="3">deployment</option>
<option value="4">testing</option>
<option value="5">research</option>
</select>
<?=$this->Form->end('Save');?>

something like this... there must be a way to mix these 2 ..... after
all its the POWER of PHP....

also can u please guide me to some links to read what can be done and
what can't be done while mixing cakephp and php and html...

thanks....

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

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]
<mailto:cake-php%[email protected]>  For more options, visit
this group at http://groups.google.com/group/cake-php?hl=en




-- 
Taffarel de Lima Oliveira (Taffarelo3)

 

Desenvolvedor Web

 

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
 
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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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