0
我需要關於如何在Codeginiter項目中使用form_dropdown的幫助。Codeigniter中的Form_Dropdown()
查看文件:my_test.php代碼,因爲這,
<?php
// basic filter form
$attributes = array('class' => 'formstyle', 'id' => 'myfilterform');
echo form_open('mytest/send', $attributes);
$options = array(
'all' => 'Pls Select Filter',
'male' => 'Male List',
'female' => 'Female List',
);
echo form_dropdown('myfilter', $options, 'male');
echo form_submit('myfiltersubmit', ' GO ');
$string = "</div></div>";
echo form_close($string);
?>
控制器文件mytest.php代碼,因爲這,
function index()
{
$data['title'] = "Hello";
$this->load->view('my_test', $data);
}
function send()
{
$mypostdata = $_POST['options']; // I can't get the post data here.
echo $mypostdata;
}
我看過的CI UserGuide的form_dropdown部分。不幸的是我沒有找到如何處理send()
中的發佈數據。謝謝。
'$ _POST ['myfilter']'工作得很好。謝謝。 – 2011-04-02 05:26:59
'var_dump($ _ POST)'也可以。我從來沒有嘗試過。驚人...!!! – 2011-04-02 05:28:52
此外,您可能希望使用Codeigniter內置的Input類,如$ filter = $ this-> input-> post(「myfilter」),它會爲您執行很多安全檢查。 – Dormouse 2011-04-02 07:38:37