The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Button Anchor link not activating
masonh928
post Apr 9 2017, 09:58 PM
Post #1


Serious Coder
*****

Group: Members
Posts: 253
Joined: 17-August 13
From: Indiana
Member No.: 19,570



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 -
CODE

<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!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Apr 10 2017, 01:43 AM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Maybe because you have 2 '&&' symbols in the query string when only 1 is needed?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 10 2017, 05:21 AM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



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.
CODE
http://indiancreekpoultry.000webhostapp.com/Pages.php?Go=Poultry&&Type=RareBreed

http://indiancreekpoultry.000webhostapp.co...;Type=RareBreed
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 10 2017, 05:26 AM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 10 2017, 05:37 AM
Post #5


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



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

http://htmlhelp.com/reference/html40/forms/button.html

CODE
Contents
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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 10 2017, 05:50 AM
Post #6


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



WTF? It works with any number of ampersands.

CODE
http://indiancreekpoultry.000webhostapp.com/Pages.php?Go=Poultry&&&&&&&&Type=RareBreed&&&&&&&&&&&&&&&&&&&&&&&Yes=true

http://indiancreekpoultry.000webhostapp.co...p;&Yes=true

Here too, but here the excessive ampersands are cleaned up (look at the address bar).
CODE
http://forums.htmlhelp.com/index.php?s=&showtopic=59289&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&view=findpost&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&p=134352

http://forums.htmlhelp.com/index.php?s=&am...p;&p=134352
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 10 2017, 05:55 AM
Post #7


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



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":
https://www.w3.org/TR/2014/REC-html5-201410...-button-element
https://www.w3.org/TR/2014/REC-html5-201410...ctive-content-0
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 10 2017, 06:26 AM
Post #8


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Yeah, should have spotted that right off. But what's with the ampersands?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 10 2017, 07:03 AM
Post #9


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 10 2017, 08:19 AM
Post #10


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



In all browsers? And this forum software is designed to work with them.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 10 2017, 10:31 AM
Post #11


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



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:

CODE
Array
(
    [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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 10 2017, 05:35 PM
Post #12


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 10 2017, 06:30 PM
Post #13


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



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:

CODE
?x=y&&&foo=bar

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

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

you get this:

CODE
Array
(
    [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).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Apr 11 2017, 01:29 AM
Post #14


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



QUOTE
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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 11 2017, 05:07 AM
Post #15


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



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.

CODE
http://www.emalbum.com/cgi-bin/emAlbum.cgi?cmd=show_image&&&&&&path=Animals&&&&&&img=1&&&&&&tn=1


http://www.emalbum.com/cgi-bin/emAlbum.cgi...;&&tn=1
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 09:18 PM