Edward Posted June 29, 2007 Share Posted June 29, 2007 Hi, I've been trying to solve this but to no avail. I know there can be problems with quotes and slashes but I've not had this specific problem before. I have multiple blocks of text (html code) containing double quotes and html tags: $email_content .= '<tr><td width="10" align="left" valign="top" cellpadding="0" cellspacing="0" border="0"></td><td width="120" height="170" align="center" valign="middle" cellpadding="0" cellspacing="0" border="0"><p>Hello</p></td><td width="10" align="left" valign="top" cellpadding="0" cellspacing="0" border="0"></td></tr>'; If certain links in the page are clicked on, specific blocks of html become added to the $content variable. I need to be able to email the $content variable via a form. So far I'm using this: //if (get_magic_quotes_gpc()) { //$email_content = stripslashes($email_content); //} $email_content = urlencode($email_content); <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p> <input type="text" name="recipient" value="<?php echo $_POST['recipient']; ?>" size="20" maxlength="100" /><br /> <input type="hidden" name="content" value="<?php echo $email_content; ?>" /> <input type="submit" name="submit_send_short_list" value="e-mail short list" /> </p> </form> if (isset($_POST['submit_send_short_list'])) { //if (get_magic_quotes_gpc()) { // $email_content = stripslashes($_POST['email_content']); // remove slashes //} $email_content = html_entity_decode($_POST['email_content']); $body = '<html>'.$email_content.'</body>'; mail($_POST['recipient'], 'my subject', $body); Toggling the above commented codes, I either end up with slashes in the email, or the $email_content row doesn't appear. Can anyone see the best way to fix this? Thank you. Quote Link to comment Share on other sites More sharing options...
bbaker Posted June 29, 2007 Share Posted June 29, 2007 not sure if you're 2nd piece of code is as it is in your actual file, but the only php code you have in <?php ?> tags is the values in the form. $email_content = urlencode($email_content); and if (isset($_POST['submit_send_short_list'])) { //if (get_magic_quotes_gpc()) { // $email_content = stripslashes($_POST['email_content']); // remove slashes //} $email_content = html_entity_decode($_POST['email_content']); $body = '<html>'.$email_content.'</body>'; mail($_POST['recipient'], 'my subject', $body); are not. Quote Link to comment Share on other sites More sharing options...
Edward Posted June 29, 2007 Author Share Posted June 29, 2007 Sorry, it's not like that in my script, I was cutting the unimportant parts out for the purpose of this post and it got changed... 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.