Help - Search - Members - Calendar
Full Version: Button Anchor link not activating
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Hi guys, it has been forever since I've last posted! Hope you are all well! biggrin.gif

I wonder if you remember me; but that's not my purpose of this post... lol

Anyways, so I have this anchor link <a> inside a <button> for bootstrap stylization purposes; however, for some reason the link is not activating, even though I know that the link works. Copy and pasted into the browser!

Click the blue button under the pages header. (Return to >> Rare Breeds))

Here is the button/link code: (In PHP, I needed to get the URL Parameters, but not relevant) The HTML rendered -

<button class='btn-primary'><a href='/Pages.php?Go=Poultry&&Type=RareBreed&&Yes=true'> Return to &gg; Rare Breed</a></button>

Anything stick out?

Thanks guys!
Maybe because you have 2 '&&' symbols in the query string when only 1 is needed?
Of course we remember you. biggrin.gif

The link doesn't work in gecko browsers either. The only browser it works in for me is Iron (Chrome clone).

I don't think the double ampersands are a mistake because they are used in all links and the other ones work. I guess one of them is in the actual query. I don't know if that's allowed or advisable though.

The double ampersands are in this link and in all the links to rare breeds on that page and they all work.
I take that back. The links work with single ampersands too. How can it be that both versions work? wacko.gif

Still, the back link works only in iron, single or double ampersands. The ampersands should be URL encoded, but I don't see why that should break anything in one single link. unsure.gif
Ah, BUTTON can't contain links. Simple as that.

Inline elements except A, INPUT, SELECT, TEXTAREA, LABEL, BUTTON, and IFRAME
Block-level elements except FORM, ISINDEX, and FIELDSET

Still wonder about those ampersands though... ninja.gif
WTF? It works with any number of ampersands.


Here too, but here the excessive ampersands are cleaned up (look at the address bar).
Christian J
QUOTE(pandy @ Apr 10 2017, 12:37 PM) *

Ah, BUTTON can't contain links. Simple as that.

Same thing in HTML5, which says "there must be no interactive content descendant":
Yeah, should have spotted that right off. But what's with the ampersands?
Christian J
AFAIK double ampersands shouldn't exist (ampersand in existing URLs should be URL-encoded as %26 when used in a query string), so maybe it's a bug.
In all browsers? And this forum software is designed to work with them.
Christian J
Seems this forum makes 302 redirects in the background where the extra ampersands are stripped out.

When I used my own test server the extra ampersands remained in the URL, so my browsers are not correcting anything. PHP's
$_SERVER['QUERY_STRING'] doesn't remove them either, but print_r($_GET) manages to sort it out, e.g. this query string ?x=y&&&foo=bar
returns this:

    [x] => y
    [foo] => bar

...and not something like [x] => &&y. So if I'd let PHP create a new query string out of the above array the extra ampersands wouldn't get included in it.
No, browsers don't remove any ampersands, but the right page is still loaded. That's my point. Why does it work at all? I would have though that all but one ampersand would be seen as part of the query that ought to fail miserably.

Where is Darin? I bet he knows this stuff.
Christian J
QUOTE(pandy @ Apr 11 2017, 12:35 AM) *

I would have though that all but one ampersand would be seen as part of the query that ought to fail miserably.

Maybe the extra ampersands are simply regarded as empty name/value pairs. If so a server-side script might ignore them (maybe depending on language). For example, with this query string:


PHP's $_GET['x'] and $_GET['foo'] return the perfectly normal values "y" and "bar". If you instead make an array of the query string with

explode('&', $_SERVER['QUERY_STRING']);

you get this:

    [0] => x=y
    [1] =>
    [2] =>
    [3] => foo=bar

with the extra "&" characters resulting in empty array items, but those should never used for anything in a PHP script anyway (unless the script looped through the unsanitized array regardless of the items it contains, but that might be bad coding practice).
Darin McGrew
Maybe the extra ampersands are simply regarded as empty name/value pairs.
That's my guess. Technically, empty name/value pairs would look like this:


because there's supposed to be an equals sign between the name and the value, but I bet the libraries used for parsing the input to server-side programs clean all that up and ignore the empty bits.
Hm. Strange. Perl seems to do it too. Hard to find this kind of Perl scripts these days but I found this gallery that is happy to accept my multi ampersands.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.