miinet Posted July 30, 2008 Share Posted July 30, 2008 I'm not sure how to assign a string with html tags. The table doesn't show up and neither does the last name. The only thing that is displayed is the first name. $message = '<html> <head> <title>Confirmation</title> </head> <body> <table cellspacing="7"> <tr> <td>First Name:</td> <td>'.$_SESSION['firstname'];'</td> </tr> <tr> <td>Last Name:</td> <td>'.$_SESSION['lastname'];'/td> </tr> </table> </body> </html> '; Link to comment https://forums.phpfreaks.com/topic/117408-solved-assign-string-with-html/ Share on other sites More sharing options...
Jabop Posted July 30, 2008 Share Posted July 30, 2008 <?php $message = '<html> <head> <title>Confirmation</title> </head> <body> <table cellspacing="7"> <tr> <td>First Name:</td> <td>'.$_SESSION['firstname'].'</td> </tr> <tr> <td>Last Name:</td> <td>'.$_SESSION['lastname'].'</td> </tr> </table> </body> </html> '; ?> Link to comment https://forums.phpfreaks.com/topic/117408-solved-assign-string-with-html/#findComment-603906 Share on other sites More sharing options...
miinet Posted July 30, 2008 Author Share Posted July 30, 2008 Hmm.. still doesn't work. Let me post the whole code. I'm actually trying to display the string message in an email. <?php session_start(); //Basic mail settings $to = $_SESSION['email'].", "; $subject = "Request"; $headers = 'MIME-Version: 1.0' . "rn"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn"; // message $message = '<html> <head> <title>Confirmation</title> </head> <body> <table cellspacing="7"> <tr> <td>First Name:</td> <td>'.$_SESSION['firstname'].'</td> </tr> <tr> <td>Last Name:</td> <td>'.$_SESSION['lastname'].'</td> </tr> </table> </body> </html> '; //Send email mail($to,$subject,$emailmessage,$headers); ?> Link to comment https://forums.phpfreaks.com/topic/117408-solved-assign-string-with-html/#findComment-603949 Share on other sites More sharing options...
wildteen88 Posted July 30, 2008 Share Posted July 30, 2008 You assign the message for your email in the $message variable, however on this line: mail($to,$subject,$emailmessage,$headers); You're using a variable called $emailmessage, which doesn't exist and thus your code doesn't work. Link to comment https://forums.phpfreaks.com/topic/117408-solved-assign-string-with-html/#findComment-603993 Share on other sites More sharing options...
miinet Posted July 30, 2008 Author Share Posted July 30, 2008 yes, and i changed it back to $message, and now it just outputs the html tags. Link to comment https://forums.phpfreaks.com/topic/117408-solved-assign-string-with-html/#findComment-604018 Share on other sites More sharing options...
wildteen88 Posted July 31, 2008 Share Posted July 31, 2008 I see you use "rn" in your code above, I presume you want a new line in which case you should use "\n" (or "\r\n") for newlines. Link to comment https://forums.phpfreaks.com/topic/117408-solved-assign-string-with-html/#findComment-604763 Share on other sites More sharing options...
miinet Posted August 1, 2008 Author Share Posted August 1, 2008 You're right. Thanks for helping me! Link to comment https://forums.phpfreaks.com/topic/117408-solved-assign-string-with-html/#findComment-605237 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.