0

Hi,
I am getting the following error when I try to submit registration on my website. Am not able to figure out the issue. Any help is greatly appreciated.


Parse error: syntax error, unexpected T_STRING in /home/content/t/h/i/thinkvirtual/html/includes/registration_mail.php on line 3


The code on registration_mail.php is

<?php
$message="<body>
<div align=¥"center¥">
<table bgcolor=¥"#eaeaea¥" border=¥"0¥" cellpadding=¥"10¥" cellspacing=¥"0¥" width=¥"600¥">
<tr>
<td>
<table bgcolor=¥"#ffffff¥" border=¥"0¥" cellpadding=¥"10¥" cellspacing=¥"0¥" width=¥"580¥">
<tr>
<td>
<table border=¥"0¥" cellpadding=¥"0¥" cellspacing=¥"0¥" width=¥"560¥">
<tbody>
<tr>
<td align=¥"left¥" valign=¥"top¥" height=¥"90¥" style=¥"border-bottom:#e0e0e0 1px solid;¥"><img src=¥"".SITE_URL."/images/logo.jpg¥" alt=¥"iElixir¥" hspace=¥"5¥" title=¥"iElixir¥" /></td>
</tr>
<tr>
<td align=¥"center¥" height=¥"300¥" style=¥"font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 12px; color: #365f91;¥" valign=¥"top¥">
<table border=¥"0¥" cellpadding=¥"0¥" cellspacing=¥"0¥" width=¥"540¥">
<tr>
<td align=¥"left¥" colspan=¥"2¥" height=¥"30¥">
<table border=¥"0¥" cellpadding=¥"0¥" cellspacing=¥"0¥" width=¥"540¥">
<tr>
<td align=¥"left¥" colspan=¥"2¥" height=¥"30¥" valign=¥"top¥" style=¥"font-weight: normal; font-size: 13px; color: #365f91; font-family: Arial, Verdana, Helvetica, sans-serif¥">

<br /><strong>Dear $fName $lName</strong>,<br /><br />
Please click below to activate your account.<br /><br />
<a href=¥"".SITE_URL."/activate.php?id=$activateid¥"> ".SITE_URL."/activate.php?id=$activateid</a>
<br /><br />If you are unable to open the link by clicking, please copy and paste the link in your browser.
<br /><BR><BR>
<BR>Administrator<BR><a href=¥"http://www.iElixir.com¥">www.iElixir.com</a><BR>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<table border=¥"0¥" cellpadding=¥"0¥" cellspacing=¥"0¥" width=¥"100%¥">
<tr>
<td height=¥"8¥" width=¥"10¥">&nbsp;</td>
<td align=¥"left¥" height=¥"30¥" style=¥"font-family: Arial, Tahoma, Verdana, Helvetica, sans-serif;
font-size: 11px; color: #444444;¥">ゥ Copyright 2010 Think Virtual, LLC. All rights reserved.
</td>
<td align=¥"left¥" valign=¥"bottom¥">&nbsp;
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>";
// To send HTML mail, the Content-type header must be set

$rsAdminEmail = $user->adminDetail();
$fromMail = $rsAdminEmail;
$toMail = $_REQUEST["email"];
$subject = "iElixir.com: Activation Mail ";
$headers = 'MIME-Version: 1.0' . "¥r¥n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "¥r¥n";
$headers .= 'From: '.$fromMail. "¥r¥n";
mail($toMail, $subject, $message, $headers);
header("location:registration.php?mesg=1");

$uName = "";
$password = "";
$email = "";
$address = "";
$fName = "";
$lName = "";
$state = "";
$city = "";
$country_id = "";
$weblink = "";
$user_type = "";
?>

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by ilanpillai
0

First of all, all of those "¥" characters didn't ring any bells?
Secondly, you must escape the same string-wrapper character. What I mean is this:

// using single quotes
$string = 'John\' Car';

// using double quotes
$string = "Dinner at \"Joe's\""
$a = "<a href=\"www.google.com\">GOOGLE!</a>

You could use HEREDOC syntax, or try PHP in HTML, but your code had constants, and those are not parsed, so, if you can find a more elegant approach, be my guest.

PS: Changed your copyright carather to this "&copy;".

$message = '
<body>
    <div align="center">
        <table bgcolor="#eaeaea" border="0" cellpadding="10" cellspacing="0" width="600">
            <tr>
                <td>
                    <table bgcolor="#ffffff" border="0" cellpadding="10" cellspacing="0" width="580">
                        <tr>
                            <td>
                                <table border="0" cellpadding="0" cellspacing="0" width="560">
                                    <tbody>
                                        <tr>
                                            <td align="left" valign="top" height="90" style="border-bottom:#e0e0e0 1px solid;"><img src="" . SITE_URL . "/images/logo.jpg" alt="iElixir" hspace="5" title="iElixir" /></td>
                                        </tr>
                                        <tr>
                                            <td align="center" height="300" style="font-family: Arial, Verdana, Helvetica, sans-serif;
                                                font-size: 12px; color: #365f91;" valign="top">
                                                <table border="0" cellpadding="0" cellspacing="0" width="540">
                                                    <tr>
                                                        <td align="left" colspan="2" height="30">
                                                            <table border="0" cellpadding="0" cellspacing="0" width="540">
                                                                <tr>
                                                                    <td align="left" colspan="2" height="30" valign="top" style="font-weight: normal; font-size: 13px; color: #365f91; font-family: Arial, Verdana, Helvetica, sans-serif">

                                                                        <br /><strong>Dear ' . $fName . ' ' . $lName . '</strong>,<br /><br />
                                                                        Please click below to activate your account.<br /><br />
                                                                        <a href="' . SITE_URL . '/activate.php?id=' . $activateid . '">' . SITE_URL . '/activate.php?id=' . $activateid . '</a>
                                                                        <br /><br />If you are unable to open the link by clicking, please copy and paste the link in your browser.
                                                                        <br /><BR><BR>
                                                                        <BR>Administrator<BR><a href="http://www.iElixir.com">www.iElixir.com</a><BR>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td height="8" width="10">&nbsp;</td>
                            <td align="left" height="30" style="font-family: Arial, Tahoma, Verdana, Helvetica, sans-serif;
                                font-size: 11px; color: #444444;">&copy; Copyright 2010 Think Virtual, LLC. All rights reserved.
                            </td>
                            <td align="left" valign="bottom">&nbsp;
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
</body>';
0

Thanks. The top part worked now but when I run the code the following is getting displayed at the bottom of the page. Any thoughts?

// To send HTML mail, the Content-type header must be set $rsAdminEmail = $user->adminDetail(); $fromMail = $rsAdminEmail; $toMail = $_REQUEST["email"]; $subject = "iElixir.com: Activation Mail "; $headers = 'MIME-Version: 1.0' . "¥r¥n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "¥r¥n"; $headers .= 'From: '.$fromMail. "¥r¥n"; mail($toMail, $subject, $message, $headers); header("location:registration_patient.php?mesg=1"); $uName = ""; $password = ""; $email = ""; $address = ""; $fName = ""; $lName = ""; $state = ""; $city = ""; $country_id = ""; $weblink = ""; $user_type = ""; ?>

0

Hi Nevermind,
I modified the code as per your suggestion ant the email functionality is working now i.e. the user receives an email to activate the account. The only issue now I am seeing is that the body of the mail displays the following instead of the hyperlink and the details. Again thank you for your help. Appreciate it !

<body>
<div align="center">
<table bgcolor="#eaeaea" border="0" cellpadding="10" cellspacing="0" width="600">
<tr>
<td>
<table bgcolor="#ffffff" border="0" cellpadding="10" cellspacing="0" width="580">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="560">
<tbody>
<tr>
<td align="left" valign="top" height="90" style="border-bottom:#e0e0e0 1px solid;"><img src="" . SITE_URL . "/images/logo.jpg" alt="iElixir" hspace="5" title="iElixir" /></td>
</tr>
<tr>
<td align="center" height="300" style="font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 12px; color: #365f91;" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="540">
<tr>
<td align="left" colspan="2" height="30">
<table border="0" cellpadding="0" cellspacing="0" width="540">
<tr>
<td align="left" colspan="2" height="30" valign="top" style="font-weight: normal; font-size: 13px; color: #365f91; font-family: Arial, Verdana, Helvetica, sans-serif">

<br /><strong>Dear John Smith</strong>,<br /><br />
Please click below to activate your account.<br /><br />
<a href="http://ielixir.com/activate.php?id=1283957352">http://ielixir.com/activate.php?id=1283957352</a>
<br /><br />If you are unable to open the link by clicking, please copy and paste the link in your browser.
<br /><BR><BR>
<BR>Administrator<BR><a href="http://www.iElixir.com">www.iElixir.com</a><BR>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="8" width="10">&nbsp;</td>
<td align="left" height="30" style="font-family: Arial, Tahoma, Verdana, Helvetica, sans-serif;
font-size: 11px; color: #444444;">&copy; Copyright 2010 Think Virtual, LLC. All rights reserved.
</td>
<td align="left" valign="bottom">&nbsp;
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>

0

Oops, missed one.
Change the bad-luck line (#13) in my code to this:

<td align="left" valign="top" height="90" style="border-bottom:#e0e0e0 1px solid;"><img src="' . SITE_URL . '/images/logo.jpg" alt="iElixir" hspace="5" title="iElixir" /></td>

As for the yen/yuan character, for the moment, I'm not quite sure why it's showing.
PS: Use the [.code][./code] tags (without the dots) when posting your code.

Later edit:
Looky what I've found! When you see a yen character, change it to a back-slash (/). Ergo, change your code accordingly:

$rsAdminEmail = $user->adminDetail();
$fromMail = $rsAdminEmail["email"];
$toMail = $_REQUEST["email"];
$subject = "iElixir.com: Activation Mail";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $fromMail\r\n";
mail($toMail, $subject, $message, $headers);
header("location:registration.php?mesg=1");

I'm not happy to say this, but you should really re-read the basic PHP syntax and concatenation.
To put it mildly, "you've got some issues".

Edited by nevvermind: n/a

0

It works now. Yes I have issues. I am not a programmer. I am trying to fix something which was coded by someone else. Thanks a ton for your help.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.