I'm trying to write a website that is dependant on being able to make a name links...so....
<a href="foo.html">foo</a>
<a href="#bar">bar</a>
<div name="bar">
</div>
However I want the content inside the bar div to give php variable information....thus...
I wanted to try to form my link as such...
<a href="#bar?var=value">bar</a>
However it isn't working....any ideas?
-
-
Cybermagellan wrote:
I wanted to try to form my link as such...
<a href="#bar?var=value">bar</a>
However it isn't working....any ideas?
Try:
<a href="?var=value#bar">bar</a>
-
Browsers dont go back to the server when you give them an internal ("#") link. Even when you think adding get-parameters would work, it often doesn't due to caching, so you can either
a) Add random data to the end of the link:\
<a href="mypage.php?important=data&random=ahadhqw#internallink">link</a>
b) Use javascript nastyness:
<a href="mypage.php#bob" onclick="getdata('mypage.php')">link</a>
If your php page returns a constant result (up to arguments) then the caching problem goes away, and you can just use ?get=args#internallink. Note that the ? must come before the #. -
Cybermagellan wrote:<a href="#bar?var=value">bar</a>
I've never actually used PHP before, so obviously, take this with a (huge) 3 carrot grain of salt, but it looks like your trying to get PHP to work within a string constant.
I'd have thought it would have been better to have PHP return the entire (computed) string instead. Just a thought.
EDIT:
Oh stupid me. You mean from the client, passing data back to your server using URL variables.
In other words, that fact that the server is using PHP isn't significant. I was looking at it from the Server side, and thinking you were using some kind of wierd PHP shortcut syntax that I'd never seen before... move along, nothing to see here...
-
Actually this was for an iPhone web app....and that wasn't working...as it turned out I'm just going to use PHP vars and create the page as needed.
-
Cybermagellan wrote:Actually this was for an iPhone web app....and that wasn't working...as it turned out I'm just going to use PHP vars and create the page as needed.
Just use $_SESSION
-
I'd rather be mauled by mosquitoes that write PHP....
...but it is interesting that Microsoft has taken the reigns.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.