Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Url in string been mangled

General discussions related to php

Moderators: macek, egami, gesf

Url in string been mangled

Postby fbartolom » Wed Oct 03, 2012 12:45 am

I compose an url in a string with the following piece of code:
Code: Select all
$unsubscribeString='<a href="http://www.miafoto.it/iPhone/phpMedia/unregister.php?language=english&email='.$to.'">If you wish to stop receiving information from us, simply click once here.</a>';
echo "<br>Sending to: ".$to;
echo "unsubscribe string=$unsubscribeString";

with the echo above returning the correct string.
http://www.miafoto.it/iPhone/phpMedia/unregister.php?language=english&email=fbartolom@gmail.com

Yet when I introduce it in the email to send it to user by the following piece of code:
Code: Select all
<span style="font:12px Chalkboard; ">
<b>Unsubscribe</b><br>
<?echo $unsubscribeString; ?>
</span>


that is how the string comes out:
http://www.miafoto.it/iPhone/phpMedia/unregister.php?language=english&email%C3%BBartolom@gmail.com

I tried encoding and decoding the string but I obtained the same result, albeit the encode version looked right, as well as inverting the parameters, or inserting the string instead of the variable in the url, but always obtaining the same result on the same email field.

I am really puzzled and quite worried as all unsubscription requests go awry and that could create big problems.
fbartolom
New php-forum User
New php-forum User
 
Posts: 17
Joined: Sun Apr 01, 2012 11:52 pm

Re: Url in string been mangled

Postby seandisanti » Wed Oct 03, 2012 8:57 am

did you click on the link? Urlencoding has happened, which replaces specific characters with percent codes. clicking the link should still take you right where you expect it to.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Url in string been mangled

Postby fbartolom » Wed Oct 03, 2012 10:42 am

seandisanti wrote:did you click on the link? Urlencoding has happened, which replaces specific characters with percent codes. clicking the link should still take you right where you expect it to.

Instead it doesn't. Just a few lines before the echo the URL is what it should be; when echoed the = is joined with the beginning of the email address to produce that weird result that all but looks like an URL encoding even if it is not. For the time being I fixed the issue by putting a space after the = and removing it before using the email address, but surely I am left totally puzzled especially as only field having this behavior is the email one and only with some email addresses.
I may send you the scripts if you like.
fbartolom
New php-forum User
New php-forum User
 
Posts: 17
Joined: Sun Apr 01, 2012 11:52 pm


Return to PHP General

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron