I cant get post to work and create a new row. I copy a table from an existing table with new fields and this works if i use put (overwrites)but I dont want put as i need a new row.
//controller
if ($this->request->is('post')) { //doesnt work
$tutoredit = array('TutorEdit' => $this->request->data['Tutor']);
$tutoredit['TutorEdit']['tutor_id']=2;
if ($this->TutorEdit->save($tutoredit)) {
////////
///view
echo $this->Form->create('Tutor', array('type' => 'post'));
echo $this->Form->input('id', $formHorizontalHtmlOptions);
echo $this->Form->input('first_name', $formHorizontalHtmlOptions);
echo $this->Form->input('last_name', $formHorizontalHtmlOptions);
echo $this->Form->input('email', $formHorizontalHtmlOptions);
echo $this->Form->input('mobile', $formHorizontalHtmlOptions);
echo $this->Form->input('home_phone', $formHorizontalHtmlOptions);
echo $this->Form->input('work_phone', $formHorizontalHtmlOptions);
echo $this->Form->input('gender', array_merge($formHorizontalHtmlOptions, array('type' => 'select', 'options' => $gender)));
echo $this->Form->end('Save Edit Request');
-- //controller
if ($this->request->is('post')) { //doesnt work
$tutoredit = array('TutorEdit' => $this->request->data['Tutor']);
$tutoredit['TutorEdit']['tutor_id']=2;
if ($this->TutorEdit->save($tutoredit)) {
////////
///view
echo $this->Form->create('Tutor', array('type' => 'post'));
echo $this->Form->input('id', $formHorizontalHtmlOptions);
echo $this->Form->input('first_name', $formHorizontalHtmlOptions);
echo $this->Form->input('last_name', $formHorizontalHtmlOptions);
echo $this->Form->input('email', $formHorizontalHtmlOptions);
echo $this->Form->input('mobile', $formHorizontalHtmlOptions);
echo $this->Form->input('home_phone', $formHorizontalHtmlOptions);
echo $this->Form->input('work_phone', $formHorizontalHtmlOptions);
echo $this->Form->input('gender', array_merge($formHorizontalHtmlOptions, array('type' => 'select', 'options' => $gender)));
echo $this->Form->end('Save Edit Request');
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment