<?php
$options = array(
500 => 500,
1000 => 1000,
2500 => 2500,
5000 => 5000,
);
echo form_dropdown('units',$options);
?>
$db_num = 25; # a random number
$post_num = $set_num * (units-selected)
单击提交时,如何将单位下拉列表的选定值与我的值相乘$db_num
?我认为这可能需要javascript,但没有可能吗?
在我的控制器上,我尝试了这个:
$db_num = $this->input->post('db_num');
$units = $this->input->post('units');
$answer = $db_num * $units;
...
echo $answer;
(结果没有错误也没有插入。我做错了什么?)