我无法理解它不会更新或保存我放置的任何记录。你能告诉我有什么问题吗?
这是我的 StockController 函数add
function add()
{
if (!empty($this->data['Stocks']))
{
if ($this->Stocks->Save($this->data['Stocks']))
{
($this->flash('Your Inventory has been added! /Stocks/'));
}
}
}
这是 add.ctp
<h1>Add Inventory</h1>
<form action="<?php echo $this->Html->url("/Stocks/add"); ?>" method="post">
<p>
ProductName:
<?php echo $this->Form->varchar('Stocks/ProductName', array('size' => '40'))?>
</p>
<p>
Price:
<?php echo $this->Form->integers('Stocks/Price', array('size' => '10'))?>
</p>
<p>
Quantity:
<?php echo $this->Form->integers('Stocks/Quantity', array('size' => '5'))?>
</p>
<p>
<?php echo $this->Form->submit('Save') ?>
</p>
</form>