Jump to content

Quotes and Slashes


Edward

Recommended Posts

 

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.

Link to comment
Share on other sites

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.

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.