Why do I have duplicate html buttons in this php code?

When I view the session variables, it shows two html buttons, and I can’t figure out why. If I extract just this code and save it as a separate php file, then it correctly shows one html version. Does anyone know why it shows two buttons? All this code does is store the html into a variable called button, and then at the end it stores it as a session variable.

Any tips would be greatly appreciated!

$button .= "<center> \n" .
"  <table width='100%'> \n" .
"   <tr> \n" .
"      <td> \n" .
"        <table border='0' cellpadding='0' cellspacing='0'>  \n" .
"          <tr>  \n" .
"            <td height='20' width='100%' style='font-size: 20px; line-height: 20px;'>  \n" .
"            &nbsp;  \n" .
"            </td>  \n" .
"         </tr>  \n" .
"       </table>  \n" .
"        <table border='0' align='center' cellpadding='0' cellspacing='0' style='margin:0 auto;'>  \n" .
"          <tbody>  \n" .
"          <tr>  \n" .
"            <td align='center'>  \n" .
"              <table border='0' cellpadding='0' cellspacing='0' style='margin:0 auto;'>  \n" .
"                <tr>  \n" .
"                  <td align='center' bgcolor='#87be45' width='150' style='-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;'>  \n" .
"                    <a href='{REDIRECTLINK}' style='padding: 10px;width:150px;display: block;text-decoration: none;border:0;text-align: center;font-weight: bold;font-size: 15px;font-family: sans-serif;color: #ffffff;background: #87be45;border: 1px solid #87be45;-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;line-height:17px;' class='button_link'> \n" .
"                      {BUTTONTEXT}  \n" .
"                    </a>  \n" .
"                  </td>  \n" .
"                </tr>  \n" .
"              </table>  \n" .
"            </td>  \n" .
"          </tr>  \n" .
"          </tbody>  \n" .
"        </table>  \n" .
"        <table border='0' cellpadding='0' cellspacing='0'>  \n" .
"          <tr>  \n" .
"            <td height='20' width='100%' style='font-size: 20px; line-height: 20px;'>  \n" .
"            &nbsp;  \n" .
"            </td>  \n" .
"          </tr>  \n" .
"        </table>  \n" .
"      </td>  \n" .
"    </tr>  \n" .
"  </table>  \n" .
"</center>  \n";

$_SESSION['buttonCode'] = $button;
1 Like

I ended up finding the problem. It was “$button .=” Once I removed the period it was working perfectly.

Thanks!

5 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.