|
-
Jul 8th, 2003, 09:50 AM
#1
Thread Starter
New Member
How 2 specify conditions in the Message of the mail body
Hi Everyone ,
I am posting my first message regarding the Contents of the Message in a body used for emailing in PHP
Just after the <TD> i have a condtion which checks whether a value exists in a variable or not, if it exists then display 1.gif and if there's nothing in the variable then display 2.gif. But the following code of mine gives a Parse Error.
i have my message set as
/* message starts here*/
$message = '
<table width=760 border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top>'.
if($var=="abc")
{
.'<img src=1.gif>'.
}
else
{
.'<img src=2.gif>'.
}
.'</td>'
/*message ends here*/
I get an error on the line where i am concatinating 1.gif.
Could any one explain whats the problem in my code
Thnx
-
Jul 8th, 2003, 03:41 PM
#2
Stuck in the 80s
That's illegal syntax. Try:
Code:
/* message starts here*/
$message = '<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">';
if($var=="abc") {
$message .= '<img src="1.gif">';
} else {
$message .= '<img src="2.gif">';
}
$message .= '</td>';
/*message ends here*/
Also of note, I believe it is invalid HTML to not have your attributes quoted. So I added those in there.
-
Jul 9th, 2003, 01:06 AM
#3
Thread Starter
New Member
Thnx a lot Hobo !!!
That did help me solve my problem...
how stupid of me, I almost forgot this approach
Anywayz Thnx a Lot....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|