这是我的观点
<?php foreach ($cart as $item): ?>
<tr>
<td><?php echo $item['name']; ?></td>
<td><?php echo $item['qty']; ?></td>
<td><?php echo number_format($item['subtotal'],2); ?></td>
<?php echo form_open_multipart('site/confirmed') ?>
<?php
$option = array();
foreach($instructor as $r){
$option[$r->id] = $r->instructor;
}
echo "<td>" . form_dropdown('instructor', $option) . "</td>";
?>
这是我的模型
'isbn' => $items['name'],
'price' => $items['price'],
'instructor' => $this->input->post('instructor'),
'qty' => $items['qty'],
当我使用 $this->input->post('instructor') 时,我总是得到零..请帮助我,请提前致谢
最佳答案
在您看来尝试一下:
<?php echo form_dropdown('instructor', $option, $this->input->post('instructor') ? $this->input->post('instructor') : $r->instructor); ?>
关于php - 我怎样才能获得购物车内下拉菜单的值(value)?总是归零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20209900/