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> '; Quote Link to comment 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> '; ?> Quote Link to comment 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); ?> Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.