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&discount_type=1&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 & 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 &
- 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
Post a Comment