javascript - Which is correct approach & or & in Wordpress urls -


as figured out, gives me problems on landing page ($tab get's variables stack ['amp;tab'] instead of ['tab'] ):

wp_redirect("admin.php?page=booking-manager&tab=customers"); 

if debug with:

$tab = isset($_get['tab']) ? $_get['tab'] : ""; echo nl2br(print_r($_request, true)); die("tab:$tab"); 

i get:

array ( [page] => booking-manager [amp;tab] => customers ) tab: 

so had use without ampersanding make if work:

wp_redirect("admin.php?page=booking-manager&tab=customers"); 

while onclick , form action attributes, & ampersanding working:

onclick:

onclick="window.location.href='<?php print(admin_url('admin.php?page=add-discount&amp;discount_type=1&amp;discount_id=0')); ?>'" 

form action:

<form action="<?php echo admin_url('admin.php?page=add-customer&noheader=true'); ?>" method="post" id="form1"> 

i know text content, should use & ampersanding in html:

<p>tom &amp; jerry</p> 

to make w3c valid. got lost in knowledge wordpress urls. also, other cms, php-fusion, know force allways use & everywhere, , parse url's & if needed.

and last question - how google & vs &amp; - google not give me results @ all, had use "& ampersand", still - how google code google understand it.

thanks you.

the & character used delimiter between key=value pairs in url string, escaping harmful application, you've seen. if have value contains should encode using http encoding (e.g., use urlencode) , not html encoding.

so, e.g., if want pass parameter name value 'tom & jerry', urlencode produce string 'tom+%26+jerry'.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -