registration email link address is empty

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bowlesj
Forum Contributor
Posts: 179
Joined: Fri Jul 18, 2014 1:54 pm

registration email link address is empty

Post by bowlesj »

Hi, I am having problems with the email I am sending out which new members of my website use to activate their account. During my gmail tests (both local host and live) it seems to work fine. However I have become aware that for some people are getting the email such that the text link they click on only contains text without any link address. I am pretty sure the PHP code that creates the link is working. It is shown below stripped of stuff that need not be shown. I have seen many forums where they say "if the link does not work then click the button". So I decided to include a button as well. After struggling with several parsing tries to get the button to work I finally got it to show in the email. However when I try to put the actual activation code into the button code and the URL as well by using variables, PHP is replacing the code inside the variables $URL and $fldMM_Activation with strange replacement characters. I remember reading that there is a command to stop PHP from doing this. Unfortunately I don't remember what it is. Does anyone have any suggestions regarding this problem. Thanks, John

Code: Select all

   $file = "ThisMachineIsLocalHostTest.txt";
   if(file_exists($file)) {
     $URL="http://LOCALHOST/MJN";
   } else {
     $URL="MyWebiste.com";
   }

   $RegisterButton = '
<table cellspacing="0" cellpadding="0"> <tr> 
<td align="center" width="300" height="40" bgcolor="#000091" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #ffffff; display: block;">
<a href="' & $URL & '/frmMemberMaster_Activation.php/?code=' & $fldMM_Activation & '" style="font-size:16px; font-weight: bold; font-family: Helvetica, Arial, sans-serif; text-decoration: none; line-height:40px; width:100%; display:inline-block"><span style="color: #FFFFFF">Click the button to activate</span></a>
</td> 
</tr> </table> 
   ';

   $message = "
<html>
<head>
<title>YCSJ activation</title>
</head>
<body>
   <p>Hello $fldMM_FirstName. Thank you for registering.<br></p>
   <p><br></p>
   <p>Click the link to activate:<br></p>
   <p><a href='$URL/frmMemberMaster_Activation.php/?code=$fldMM_Activation'>Click here to activate your account</a></p>

   <p> <br></p>	

   $RegisterButton


</body>
</html>
";
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: registration email link address is empty

Post by Christopher »

You are concatenating $RegisterButton with &'s in the code above. Is that a typo? If not is should be

Code: Select all

 $RegisterButton = ' ... <a href="' . $URL . '/frmMemberMaster_Activation.php/?code=' . $fldMM_Activation . ' ... ';
For $message, instead of using single quotes for the HTML attributes, use \" to use double quotes in the double quoted string.
(#10850)
bowlesj
Forum Contributor
Posts: 179
Joined: Fri Jul 18, 2014 1:54 pm

Re: registration email link address is empty

Post by bowlesj »

Thanks Christopher, no it is forgetting. I have taken about 3 months off and have not been doing much PHP programming. I slipped back into MS-Access syntax. How quickly we forget (use it or loose it). I will give it a try again with the period instead. I will try your other suggestion too. Thanks again, John

P.S. it worked. Thanks so much.
Post Reply