dragon2025 2010-10-19 13:42
浏览 59
已采纳

PHP - 为什么我在$ _GET变量上获得未定义的索引? (可能.htaccess冲突)

I'm trying to make a data filter with php and to do so, I want to use a form with 'get' method. Not the problem is, that I get this notice, when I'm trying to refer to any of the $_GET['var']'s.

echo $_GET['kraj'];

Notice: Undefined index: kraj in C:\wamp\www\inc\pages\filtr.php on line 23

And here is the URL code:

alt text

What I think may be the problem is .htaccess file, that rewrites the URL's to pretty ones.

Here is an example of my .htaccess:

RewriteEngine on
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ index.php?detail1=$1&detail2=$2&detail3=$3 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?detail1=$1&detail2=$2 [L]
RewriteRule ^([^/\.]+)/?$ index.php?detail1=$1 [L]

Is it possible to refer to $_GET[''] after the '?' simbol with those rules? If not, how can I fix it, so it can work.

Thanks, Mike

  • 写回答

1条回答 默认 最新

  • dongwu9647 2010-10-19 13:48
    关注

    Add QSA to the flags to append to the query string instead of replacing it.

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

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部