Forums

Include email address in redirect link

pth 07 Sep, 2009
I'm building a form which creates a link with variable information in it. I'm using the following bit of code in the "On submit code - after sending email" box:

<?php
$baseurl = "https://www.xxxxxxxxxxx.nl/tft/authentication.jsp";
$psk = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$organisation="605";

// SSO code is time dependent !
$time = date("YmdH");
$ssocode= md5($time . $iduser . $psk);

// NOTE URL ENCODING
echo " <a href=\"" , $baseurl ,
"?iduser=" , urlencode($_POST['lastname']. $_POST['emailaddress']) ,
"&organisation=" , $organisation ,
"&lastname=" , urlencode($_POST['lastname']) ,
"&emailaddress=" , urlencode($_POST['emailaddress']) ,
"&infix=" , urlencode($_POST['infix']) ,
"&initials=" , urlencode($_POST['initials']) ,
"&bron=" , urlencode($_POST['bron']),
"&ssocode=" , $ssocode , "\"><img src=\"/images/stories/submitpage.jpg\"></a>"; ?>

Everything works fine, the link is created with the information that is filled in in the form. An example of the link is:

https://www.xxxxxxxxxxx.nl/tft/authentication.jsp?iduser=HaafEmail%40email.com&organisation=605&lastname=Haaf&emailaddress=Email%40email.com&infix=ten&initials=P&bron=&ssocode=120d2fd2eac971c12ceb3dca67eb351e

The problem I have is when an email address is used in the form. In the example above, I have used [email]email@email.com[/email]
The email address is incorrectly stored in the link as email%40email.com

Is it possible to correct this?
GreyHead 07 Sep, 2009
Hi pth,

That's the url encoded version of the email address so it's probably correct.

Bob
pth 08 Sep, 2009
Thanks for the quick reply.

I don't know why I used "urlencode" in my code, probably copied it from somewhere. I removed the "urlencode" part, the email address is now included correctly. Thanks again.
GreyHead 08 Sep, 2009
Hi pth,

Using urlencoded may well be correct if you are actually creating a url tht you want to use. Some characters -like spaces - can't be used in urls but the coded version will give the same result. See the Wikipedia article

Bob
This topic is locked and no more replies can be posted.