在我的zend項目中,我想要展示一些健康問題 - 一個下拉框和一個text-area.My控制器和視圖如下。zendframework中的數據提交
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$healthproblems =new Model_DbTable_Healthproblems();
$this->view->healthproblems=$healthproblems->fetchAll();
}
public function addAction()
{
}
}
--index.phtml--
<table border='1'>
<tr>
<th>Name</th>
<th> </th>
<th> </th>
</tr>
<?php foreach($this->healthproblems as $prob) : ?>
<tr>
<td><?php echo $this->escape($prob->healthproblem_name);?></td>
<td><select id="ddl_<?php echo $prob->prob_id; ?>">
<option selected="selected">--Select--</option>
<option>Yes</option>
<option>No</option>
</select></td>
<td><input type="text" style="width: 50px" value=""></input></td>
</tr>
<?php endforeach; ?>
<tr><td colspan="3" align="center">
<input type="submit" id="submit" value="Submit" ></input></td></tr>
我的問題是「如何將這些數據添加到數據庫? 「字段,如問題和note.Any其他交替的方式是可能的? HeaalthProblems包含在一個表中,我想將每個人的問題插入到另一個表中。請幫助我..