【问题标题】:I want to post form data using codeigniter but I am getting this error . How to do this?我想使用 codeigniter 发布表单数据,但出现此错误。这个怎么做?
【发布时间】:2016-03-13 02:14:38
【问题描述】:

我想将输入文本发布到我的控制器,但是当我运行“页面未正确重定向”时出现错误,并且 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>

我的路由.php

$route['search_profile_controller/(:any)'] =   'search_profile_controller';
$route['search_profile_controller/(:any)'] =   'search_profile_controller/profile_clicked';

【问题讨论】:

标签: php codeigniter


【解决方案1】:

改变你的行动

action="http://localhost:1337/PhpProject1/search_profile_controller/profile_clicked"

action="<?php echo base_url() ?>search_profile_controller/profile_clicked"

【讨论】:

  • 当我使用 base_url() 我的 css 和 jquery 不加载它只是显示标题和页面的其余部分是空白的
  • @user2848909 乐于提供帮助
猜你喜欢
  • 2023-03-24
  • 2023-03-30
  • 1970-01-01
  • 1970-01-01
  • 2020-10-18
  • 2017-02-04
  • 2015-10-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多