For example, I've seen web pages which have: index.php?id=dffdfd The dffdfd variable is then automatically added on the webpage itself...how did they do that, especially whatever id is entered in the url it's generated on the webpage when it's refreshed...
The basic idea is to set the window.location.hash property to a value that contains whatever state information you need, then either use the window.onhashchange event, or for older browsers that don't support onhashchange (IE < 8, Firefox < 3.6), periodically check to see if the hash has changed (using setInterval for example) and update the page. You will also need to check the hash value on page load to set up the initial content.
Hi, thanks. I'm not that's it - I thought it's to do with extracting a specific variable - like on this: http://forums.digitalpoint.com/showthread.php?t=1866295 ?
I think that's along the same line but how can I duplicate a typed in $id in the url, which is then displayed on the actual page itself?
Thats how its done, as long as its valid, take the example showthread.php?t=2447750 you could write in showthread.php if (isset($_GET['t'])) { $t = $_GET['t']; echo $t; } PHP: which would then print the topic number if it exist. type in another topic number which exist, and it will print it after page loaded. If it doesnt exist, it would not print it. To generate that on the fly while your typing, javascript / jquery has to be used. Though iam not sure if its good idea regarrding security
Could you tell us for what purpose? Your original post doesnt seem to make sense to me. If one type something in the url, what is supposed to happen beside a hit on "enter" on your keyboard? which make him go to that page. And then the javascript var value would be lost unless its cached. And then, its simplier to just use the php method, its crossbrowser and bulletproof