Jump to content

get a varibal value from url


xbl1

Recommended Posts

Single or double quotes don't make any difference.
Not completely right. Double quotes allow you to refer to PHP variables within the strings they encompass, whereas everything in single quotes is outputted literally. The overhead of using double quotes in strings with no variable references is unnoticeably small though (from one test that I made it's under 0.1ms at 1 million iterations), so if you can't make it a habbit to use single quotes - so be it.
Link to comment
Share on other sites

Not completely right. Double quotes allow you to refer to PHP variables within the strings they encompass, whereas everything in single quotes is outputted literally. The overhead of using double quotes in strings with no variable references is unnoticeably small though (from one test that I made it's under 0.1ms at 1 million iterations), so if you can't make it a habbit to use single quotes - so be it.
my url become to "http://www.mysite.com/country/Category.php?page=1"and i tried to print out the value by print_r[$_REQUEST['page']it still not work.the following is my work, could you help me to find out why? thanks.in the .htaccess file, i create a rewrite rule.RewriteEngine OnRewriteCond %{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.phpecho $_GET['page'];or $_REQUEST['page'];or $_POST['page'];but it does not work.
Link to comment
Share on other sites

print_r isn't an array, it is a function - try

print_r($_REQUEST['page']);

I'm not too familiar with mod_rewrite, but that rule might be chopping off the querystring - what do you see in your browsers URL bar when you click on a link to category.php ?

Link to comment
Share on other sites

That is correct - try

print_r($_REQUEST);

Oh btw - what version of PHP are you using?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...