Forum Moderators: phranque

Message Too Old, No Replies

get a value from url

get a value from url

         

xbl01234

1:38 am on Nov 24, 2007 (gmt 0)

10+ Year Member



My url become to "http://www.mysite.com/country/Category.php?page=1"

i tried to get the value of the page, but it does not work.

If i do use the mod_rewrite to rewrite the url, i could get the value
from url, but after i add the mod_rewrite rule, i could not get it.

the following is my work, could you help me to find out why? thanks.

in the .htaccess file, i create a rewrite rule.

RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=([^&]+)
RewriteRule ^([a-z]+)/Category.php$ /Category.php?[L]

then in the index.php file

<a href="country/Category.php?page=1">the country </a> <br>
<a href="city/Category.php?page=1"> the city </a> <br>

and in the category.php
echo $_GET['page'];
or $_REQUEST['page'];
or $_POST['page'];

but it does not work.

xbl01234

1:41 am on Nov 24, 2007 (gmt 0)

10+ Year Member



>If i do use the mod_rewrite to rewrite the url, i could get the value
from url, but after i add the mod_rewrite rule, i could not get it.

i am sorry, the above is;
If i do not use the mod_rewrite to rewrite the url, i could get the value
from url, but after i add the mod_rewrite rule, i could not get it.

jdMorgan

3:36 am on Nov 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



By rewriting the URL to remove the query string, you make it impossible to use GET.

It is likely that you are approaching this problem backwards -- See this thread [webmasterworld.com] for more information.

Jim

xbl01234

7:56 pm on Nov 24, 2007 (gmt 0)

10+ Year Member



Thanks a lot