fantic Posted November 20, 2008 Share Posted November 20, 2008 we can program on php like get form or method (ie: view.php?item=23) then it shows item 23 from $_GET['item'] or $_REQUEST['item']. can we make like this(view.php#23) dynamically? Quote Link to comment https://forums.phpfreaks.com/topic/133453-can-php-find-items-on-address-bar/ Share on other sites More sharing options...
ratcateme Posted November 20, 2008 Share Posted November 20, 2008 do you want to get the 23 out of a URL like view.php#23 this i not possiable in php as browsers don't send that part in a request. you might be able to get it with JavaScript but i don't know how. Scott. Quote Link to comment https://forums.phpfreaks.com/topic/133453-can-php-find-items-on-address-bar/#findComment-694122 Share on other sites More sharing options...
haku Posted November 20, 2008 Share Posted November 20, 2008 You can retrieve the whole URL and parse it for the # sign, then take whatever comes after that. But I'm not going to write that code. This should get you pointed in the right direction: http://www.webcheatsheet.com/PHP/get_current_page_url.php It will tell you how to get the page URL. Then you can use the PHP string functions to extract the part of the URL that you want. Quote Link to comment https://forums.phpfreaks.com/topic/133453-can-php-find-items-on-address-bar/#findComment-694193 Share on other sites More sharing options...
ratcateme Posted November 20, 2008 Share Posted November 20, 2008 that page suggests that the #value is kept in $_SERVER['REQUEST_URI'] if you go to a page with phpinfo() say it was called ini.php and you go to ini.php#testStringtoSearch and search for testStringtoSearch you can't find it because it is never sent to the server. Scot. Quote Link to comment https://forums.phpfreaks.com/topic/133453-can-php-find-items-on-address-bar/#findComment-694196 Share on other sites More sharing options...
haku Posted November 20, 2008 Share Posted November 20, 2008 Ahh, you're correct. My mistake. Quote Link to comment https://forums.phpfreaks.com/topic/133453-can-php-find-items-on-address-bar/#findComment-694198 Share on other sites More sharing options...
Adam Posted November 20, 2008 Share Posted November 20, 2008 Well why not just send it in the URL as a $_GET param? The purpose of #anchorName is to jump to different parts of the page without reloading, so it's not going to make another request to the server anyway. Adam Quote Link to comment https://forums.phpfreaks.com/topic/133453-can-php-find-items-on-address-bar/#findComment-694204 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.