dqb78642 2013-01-07 18:28
浏览 31
已采纳

CodeIgniter $ _POST数据为空

First, relevant code:


View

<div id="search">
    <?= form_open('sheet/search') ?>

    <?= form_input('search_query', '', 'id="search_query" placeholder="Search Sheet Music"') ?>
    <?= form_submit('submit', 'Search!', 'class="hidden"') ?>

    <?= form_close() ?>
</div>

Controller sheet/search

public function search()
{
    if ($this->input->post('search_query'))
    {
    // blah
    // [ ... ]

$_POST is completely empty.


What on earth? The annoying thing is, other forms work perfectly fine on my website. Furthermore, this works perfectly on my testing server... so I'm guessing there's something wonky with my configuration files, .htaccess, or something. However, I don't know what could be causing it.

If you have an idea and need more information, feel free to specify. I just have no idea where to look, or what to change! Any help would be hugely appreciated.

Thanks!


EDIT 1/8/2013

Okay, I made a discovery. When my index page is removed from config/config.php, the search does not work. However, when it is added, it DOES work.

It still doesn't make any sense.

Below is my .htaccess file. Think I need to modify it somehow? I have absolutely no idea why it's not working still, but this is a step in the right direction.

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|sheet|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
  • 写回答

1条回答 默认 最新

  • dongqi3533 2013-01-09 03:09
    关注

    AHA, I got it!

    The problem was pretty sneaky. Apparently, because my .htaccess file was excepting the sheet directory, AND the controller had the same name, things were going screwy with the CodeIgniter paths. What, exactly, I don't know. But it was bad, apparently!

    To anyone in the future with this problem... make sure your .htaccess file isn't messing with your controllers!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了