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 = "[email protected]"; 
$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
https://forums.phpfreaks.com/topic/182480-html-tag-in-php/
Share on other sites

<?php

$to_email = "[email protected]";
$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
https://forums.phpfreaks.com/topic/182480-html-tag-in-php/#findComment-963076
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 = "[email protected]"; 
$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
https://forums.phpfreaks.com/topic/182480-html-tag-in-php/#findComment-963080
Share on other sites

<?php

$to_email = "[email protected]";
$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
https://forums.phpfreaks.com/topic/182480-html-tag-in-php/#findComment-963081
Share on other sites

<?php
...
$message = '<table width="676"><tr>Hi    
<td width="30" height="52">
.....'; 

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

 

This doesn't work my frd...it sends the message as <table>.........Hi <td width......>

 

We want to use the HTML table and its images which it calls and send only HI

 

Link to comment
https://forums.phpfreaks.com/topic/182480-html-tag-in-php/#findComment-963083
Share on other sites

<?php
$to_email = "[email protected]";
$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
https://forums.phpfreaks.com/topic/182480-html-tag-in-php/#findComment-963084
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.