Adrian Patterson
Adrian Patterson

Reputation: 35

Replace %26 with ampersand

Every piece of research I look up refers to replacing the ampersand with %26, when in fact I want to replace %26 in the URL with the ampersand.

At the moment each time I pass the url under the GET command I get %26 back.

For example the code I am passing in the form is as follows

    <form method="get" action="<?php echo $SERVER['PHP_SELF'];?>">

    <input type="text" id="stg" name="stg" size = "25" value="<?php echo '?pn=' . $sub1 .'%26'.$jrny.'&Subject='.$Subject.'&pn2='.$sub1. '&arc='.$sess.'&Table_Id='.$Table_Id; ;?>" />

When I try string replace or rawurlencode functions I still end up with %26. What am I doing wrong?

Thanks

Upvotes: 1

Views: 4757

Answers (1)

jh314
jh314

Reputation: 27792

You can use the urldecode function:

print_r(urldecode ( "%26" ));

will print out:

&

Upvotes: 4

Related Questions