I can do this:
<a href="home.php?var=home">home</a>
But when I have a link with an Id, I can't pass variables:
<a href="home.php#sectionID?var=home">home</a> <--!this doesn't work of course -->
Thanks a lot!
I can do this:
<a href="home.php?var=home">home</a>
But when I have a link with an Id, I can't pass variables:
<a href="home.php#sectionID?var=home">home</a> <--!this doesn't work of course -->
Thanks a lot!
When using PHP you can not use '#' in the URL, it will not be passed to the server.
You can use urlencode in order to encode the non-alphanumeric characters.
Declare a variable with $home dollar sign, i think you getting confused with JavaScript variable and PHP. To retrieve the variable values on a new page use $_GET['ID'].
Hope this helps.
Use window.location.hash
in javascript
<script>alert(window.location.hash);</script>
And the parse_url()
function in PHP
<?php echo parse_url("home.php?var=home#sectionID",PHP_URL_FRAGMENT);?>
your HTML will be..
<a href="home.php?var=home#sectionID">home</a>