is correct, however, the period_id is being stored as 0. They are both
int(11).
Problem:::: I need to tell cake to: store the value of the option
being sent into the period_id column.
Solution::::?????? Thanks for your help!
Here is my database
name:students
field1:period_id
field2:user_id
Here is my StudentsController.php
public function add() {
if ($this->request->is('post')) {
$this->request->data['Student']['user_id'] = $this->Auth-
>user('id');
if ($this->Student->save($this->request->data)) {
$this->Session->setFlash('Class successfully added.');
$this->redirect(array('action' => 'index'));
}
}
$periods = $this->Period->find('list');
$this->set(compact('periods'));
}
Here is my add.ctp View
echo $this->Form->create('Student');
echo $this->Form->input('period');
echo $this->Form->end('Add Class');
Here is the source code from Students/add
<div class="input select"><label for="StudentPeriod">Period</label>
<select name="data[Student][period]" id="StudentPeriod">
<option value="57">Class 1</option>
<option value="56">Class 2</option>
<option value="52">Class 3</option>
<option value="51">Class 4</option>
<option value="59">Class 5</option>
</select>
</div>
--
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