hello everyone,
i just finished the blog tutorial and started to write mit own code.
I got this controller:
<?php
class DealerController extends AppController {
function index() {
$this->set('dealers',$this->Dealer-
>find('all'));
}
function add() {
if(!empty($this->data)) {
if($this->Dealer->save($this->data))
{
$this->Session-
>setFlash("POST_SAVED");
$this-
>redirect(array('controller' => 'dealer', 'action' => 'index'));
}
}
}
}
?>
This model:
<?php
class Dealer extends AppModel {
var $name = "Dealer";
}
?>
This index.ctp view:
<h1><?php echo SUPPLIERS; ?></h1>
<table>
<?php foreach($dealers as $su) { ?>
<tr>
<td><?php echo $su['name']; ?></td>
</tr>
<?php } ?>
</table>
and this add.ctp:
<h1><?php echo "ADD_SUPPLIER"; ?></h1>
<p>ADD_SUPPLIER_TEXT</p>
<?php
echo $form->create("dealer",array('url' => '/dealer/add'));
echo $form->input("name");
echo $form->input("address");
echo $form->input("phone");
echo $form->end("submit");
?>
If I try to save a new dealer with the form, the method "save" returns
true, but no data is stored in the DB ... i just dont get it :-/
please help me!
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