fgict
asked on
urlencode showing + instead of %20
New to PHP, so please bare with me...
I am trying to display a variable with "%20" instead of space, but code is just producing a "+" symbol
Example I have a product code "80000 #ABC" and I need to display it as "80000%20%23ABC" to ensure some of my javascript code works correctly
My current code <?= urlencode($product['prod_c ode']) ?> just produces "80000+%23ABC"
I am trying to display a variable with "%20" instead of space, but code is just producing a "+" symbol
Example I have a product code "80000 #ABC" and I need to display it as "80000%20%23ABC" to ensure some of my javascript code works correctly
My current code <?= urlencode($product['prod_c
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you code is working perfectly with me.
<script language="JavaScript" type="text/javascript">
<!--
function open_popup(product_code) {
window.open("sendtoafriend.php?prod_code="+product_code,"Send_to_a_friend","menubar=no,width=440,height=380,toolbar=no");
}
//-->
</script>
<li class="send"><a href="javascript:open_popup('80000%20%23ABC')" onMouseOver="self.status='Send to a friend'; return true;">Send to a friend</a></li>
ASKER
Ok, Looks like that code will work, however, in my example i'm still having problems, the button for Tell a Friend shows the correct code now:
<li class="send"><a href="javascript:open_popu
It then loads the sendtoafriend.php popup window with path /sendtoafriend.php?prod_co
<script language="JavaScript" type="text/javascript">
<!--
function open_popup(product_code) {
window.open("sendtoafriend
}
//-->
</script>
Or maybe it is the Send to a Friend Form (sendtoafriend.php) itself, see code on top of this page here:
<?php
// Record what product we're linking to.
$product_code = rawurlencode($_GET['prod_c
?>