0

やあみんな、私のコントローラーに何かを渡そうとしているだけだ。codeigniterを使用すると、以下のフォームは実際にはどこにもリダイレクトされません。何が問題なのですか?

私の2番目の質問は、コントローラーのデータを簡単に取得する方法です。

$data = $this->input->$post('search'); 

<?php
$options = array(
                  'small'  => 'Small Shirt',
                  'med'    => 'Medium Shirt',
                  'large'   => 'Large Shirt',
                  'xlarge' => 'Extra Large Shirt',
                );

$shirts_on_sale = array('small', 'large');
echo form_dropdown('shirts', $options, 'large');

?>
 <form  action="<?php echo site_url('home/id_search');?>" method="post"><input type="submit" value="submit" id="" name="" >
</form>
4

1 に答える 1

2

フォームの開始タグを間違った位置に配置しました。次の手順を実行します。

 <form  action="<?php echo site_url('home/id_search');?>" method="post">
<?php
$options = array(
                  'small'  => 'Small Shirt',
                  'med'    => 'Medium Shirt',
                  'large'   => 'Large Shirt',
                  'xlarge' => 'Extra Large Shirt',
                );

$shirts_on_sale = array('small', 'large');
echo form_dropdown('shirts', $options, 'large');

?>
<input type="submit" value="submit" id="" name="btnSubmit" />
</form>

And to get POST date in you controller, do:
$data = $this->input->post('shirts'); //for getting shirts form field value
于 2012-09-09T12:11:43.150 に答える