Nothing standard for that. This works:
Code:
function getQval(n) {
if(typeof n !== 'string'){
return null;
}
var r = new RegExp('[?&;]' + n + '=([^&;#]*)'), m = location.search;
return (m = r.exec(m))? unescape(m[1]) : null;
}
With that in hand (already available to the page), you can replace:
PHP Code:
<?php echo $_GET['id'];?>
with:
Code:
<script type="text/javascript">document.write(getQval('id'));</script>
There are of course various other ways to use it. And it will now only work if the client has javascript enabled, so best to keep some form of the PHP version as a fall back. How you implement either/both depends a lot upon what exactly you are trying to do.
Bookmarks