Hey, I've created a script that sends a confirmation e-mail to the user who has just registered. It send them a link that they can click to activate their account (the norm). The link should be like this: "http://siteURL.com/activate.php?userName=$userName&activate=$activate". However for some reason it seems to add a "%0A", which is the url encoded version of ":" (if I'm correct) in the middle of the code (just before $userName) so that the link doesn't work. The code uses the mail() function. The message I'm sending is stored in $message and the part that's causing the problems is this: ...code exists above this... $message .= '<li><b>Automated</b> - Just click <a href="http://www.siteURL.com/activate.php?userName='; $message .= $userName . '&activate=' . $activate; ...etc... PHP: Is there a blatent error I've made there??? Coz I sure don't see it...
That code is fine. Why split it up though? I'd keep building the link until it's done, then continue building the message, to avoid anomalies.
What do you mean split it up? The fact that I have 2 "$message .="? I actually don't know why I did that... Anyway thanks for checking the code out. I managed to fix the problem by playing around a little. I still don't understand why the above method caused problems though...
Yeah, that's what I meant. It's fine chopping it up in readable chunks but I'd do so at 'logical' stages, not half-way building a link because it can cause loosing sight of things. Glad it magically disappeared again.
I see where you're coming from and I'll keep it in mind in the future Anyway yeah I'm glad the random "%0A" disappeared too
Hi there, Just wanted to say that the %0A is actually the URL Encoded form of the Line Feed (LF or the \r ) character and not ':'. So maybe you were not trimming your input data properly before using them . $blah = trim($blih); PHP: Just my 2c Thomas