Jump to content

HTML tag in PHP


salman_ahad@yahoo.com

Recommended Posts

I am trying to send email in for of a template

 

<?php
$to_email = "info@ideatoceo.com"; 
$subject = "Greetings";
$message =?> <table width="676">  //Getting unexpecting ';' here
  <tr>
Hi
    <td width="30" height="52"><img src="Side.gif" width="30" height="50" alt="Corner" /></td>
    <td width="600"><img src="Top.gif" width="600" height="50" alt="Top" /></td>
    <td width="30"><img src="Side.gif" width="30" height="50" alt="Corner" /></td>
  </tr>
</table>

 

I am getting a unexpected';'

 

How can I properly arrange the table here?

 

Link to comment
Share on other sites

<?php

$to_email = "info@ideatoceo.com";
$subject = "Greetings";
$message = 
echo '<table width="676"><tr>Hi    
<td width="30" height="52"><img src="Side.gif" width="30" height="50" alt="Corner" /></td>    
<td width="600"><img src="Top.gif" width="600" height="50" alt="Top" /></td>    
<td width="30"><img src="Side.gif" width="30" height="50" alt="Corner" />
</td></tr></table>'; ?>

Link to comment
Share on other sites

Are you sure echo is going to work, because I would be using mail() function at the end right???

 

<?php
$to_email = "info@ideatoceo.com"; 
$subject = "Greetings";
$message =?> <table width="676">  //Getting unexpecting ';' here
  <tr>
Hi
    <td width="30" height="52"><img src="Side.gif" width="30" height="50" alt="Corner" /></td>
    <td width="600"><img src="Top.gif" width="600" height="50" alt="Top" /></td>
    <td width="30"><img src="Side.gif" width="30" height="50" alt="Corner" /></td>
  </tr>
</table>
<?php	mail($to_email, $subject, $message); 
?>

Link to comment
Share on other sites

<?php

$to_email = "info@ideatoceo.com";
$subject = "Greetings";
$message = '<table width="676"><tr>Hi    
<td width="30" height="52"><img src="Side.gif" width="30" height="50" alt="Corner" /></td>    
<td width="600"><img src="Top.gif" width="600" height="50" alt="Top" /></td>    
<td width="30"><img src="Side.gif" width="30" height="50" alt="Corner" />
</td></tr></table>'; 

mail($to_email, $subject, $message);

Link to comment
Share on other sites

<?php
$to_email = "info@ideatoceo.com";
$subject = "Greetings";
$message = ''
. '<table width="676">'
. 	'<tr>'
. 		'Hi'
. 		'<td width="30" height="52"><img src="Side.gif" width="30" height="50" alt="Corner" /></td>'
. 		'<td width="600"><img src="Top.gif" width="600" height="50" alt="Top" /></td>'
. 		'<td width="30"><img src="Side.gif" width="30" height="50" alt="Corner" /></td>'
. 	'</tr>'
. '</table>';

?>

 

might be easier to read and the reason it doesnt display correctly is probably because your table isnt set up right and you have to tell the mail function that you want to send mail in html mode.

 

e.g.

 

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

mail($to_email, $subject, $message, $headers);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.