Jump to content

Quotes keep getting escaped by slashes


DeX

Recommended Posts

I have a drop down box like so:

<select name="form1[20][Coverall Type]" id="Coverall Type" value="" onmouseover = "hint('Select overall type', 'coverallHint')" onmouseout = "nohint('coverallHint')" >
<option value = "Short (5'2 - 5'7, 2'7 inseam)">Short (5'2" - 5'7", 27" inseam)</option>
<option value = "Regular (5'8" - 6'0", 28.5" inseam)">Regular (5'8" - 6'0", 28.5" inseam)</option>
<option value = "Long (6'1" - 6'2", 30" inseam)">Long (6'1" - 6'2", 30" inseam)</option>
<option value = "X-Long">X-Long</option>
</select>

 

And I email it with PHP like so:

$message = ""; 
$form = $_POST['form1'];

// Loop array
foreach($form as $rowid => $columnarray)
{

   	// Loop each column for this row
   	foreach($columnarray as $column => $value)
{
	$message .= $column . ": " . $value . "\n";
}
}
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: ******@*****.com\r\nReply-To: *****@******.com";
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );

 

But when I get the email, it looks like so:

Coverall Size: 30
Coverall Type: Short (5\'2 - 5\'7, 2\'7 inseam)

 

So as you can see, it inserts the slashes to escape the quote characters. I'm also trying to put double quotes in there for inches but I'm just working on the single quotes right now. Any idea why it's doing this? How do I stop it? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/210802-quotes-keep-getting-escaped-by-slashes/
Share on other sites

Your PHP configuration most probably has a setting called magic_quotes enabled. Which automatically escapes quotes in variables such as _GET, _POST, _COOKIE etc.

 

Reading this will help you

http://php.net/manual/en/security.magicquotes.php

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.