php - Problem with checking GET

367

I am trying to check $GET array. But i have some problem.

URL: http:// www.my.qqq/?s=lessons

Code:

if (!empty($_GET['s'])) {
 echo '1';
}
else {
 echo '0';
}

Result: 0

But if i use http:// www.my.qqq/index.php?s=lessons

But script is working normaly if i am using both adresses except GET.

Why GET is not working with this url http:// www.my.qqq/?s=lessons and working with http:// www.my.qqq/index.php?s=lessons?

PS. OS: Windows

My problem was RewriteRule ^([a-z_]*)/?$ index.php?s=$1

If somebody knows: How to make http:// www.my.qqq/?s=lessons and http:// www.my.qqq/lessons/ available in one time?

Answer: [QSA] flag at the end of Rewrite rule ^([a-z_]*)/?$ index.php?s=$1 [QSA]

Thanx all for help!

54

Answer

Solution:

You didn't mention which web server you are using. This looks to be a problem with your URL rewriting rules; for Apache, ensure thatmod_rewrite preserves the query string (the portion after the?).

People are also looking for solutions to the problem: php - is there a max_value function for xml child node?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.