我想将输入文本发布到我的控制器,但是当我运行“页面未正确重定向”错误时,index.php会自动出现在url中,如“http://localhost:1337/PhpProject1/search_profile_controller/Index.php”。我已经通过htaccess从我的网址中删除了index.php!我的代码在这里
class Search_profile_controller extends CI_Controller{
public function profile_clicked(){
$data = $this->input->post('input_profile');
$this->load->view('profile_view',$data);
echo $data;
}
}
我的HTML
<form id="frm" name="frm" action="http://localhost:1337/PhpProject1/search_profile_controller/profile_clicked" method="post" >
// I input value from jquery and submit it dynamically
</form>
我的route.php
$route['search_profile_controller/(:any)'] = 'search_profile_controller';
$route['search_profile_controller/(:any)'] = 'search_profile_controller/profile_clicked';
答案 0 :(得分:0)
更改您的操作
action="http://localhost:1337/PhpProject1/search_profile_controller/profile_clicked"
到
action="<?php echo base_url() ?>search_profile_controller/profile_clicked"