submitted or not.
$profs = $this->Prof->find(...);
if ($this->data){
// name in $profs[$this->data['Quest']['prof_id']]
}
$this->set(compact('profs'));
On Fri, Mar 16, 2012 at 11:36 AM, ashok saini <ashoksaini1974@gmail.com> wrote:
> I can get value of select field by
> Teacher — <?=$this->data['Quest']['prof_id']?>
> but how to get array?
> The form contains <?=$form->select("prof_id",$profs,null,array("style"
> => "width:80%"))?>
> The table where form data is stored has prof_id. The $profs comes from
> another table where id and name (fio) is stored.
>
> controller code is
> function quest_new(){
> $this->fastNav['/student/quest/'] = "ques";
> $this->fastNav['/student/quest_new/'] = "new ques";
> if ($this->data){
> $this->data['Quest']['student_id'] = $this->user['student']['id'];
> $this->data['Quest']['read'] = 0;
> $this->data['Quest']['is_stud'] = 1;
> if ($this->Quest->save($this->data)){
> $this->set("done",true);
> // add and send email to me
> $contacts = $this->Contact->find("first");
> $this->Email->from = "no-reply@domain.com";
> //$this->Email->replyTo = $this->user['student']['mail'];
> $this->Email->sendAs = "html";
> $this->Email->subject = "new question";
> $this->Email->template = "question_to_prof";
> $this->Email->to = "ashok@mymail.com";
> $this->Email->send();
> //
> }
> }
> $this->set("profs",$this->Prof->find("list",array("order" =>
> "fio","fields" => "fio")));
>
> }
>
> --
> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment