Special signs in contact form

Hello, i’ve got contact form which when i write msg in it with special signs for example polish signs or in english <’> <"> it sends just <?>

I have no idea why it could be happened my html file is coded ok utf-8 and here’s php code

[php]<?php
$names = $_POST[‘names’];
$email = $_POST[‘email_address’];
$comment = $_POST[‘comment’];
$to =‘[email protected]’;

$message = “”;
$message .= "Name: " . htmlspecialchars($names, ENT_QUOTES) . “
\n”;
$message .= "Email: " . htmlspecialchars($email, ENT_QUOTES) . “
\n”;
$message .= "Comment: " . htmlspecialchars($comment, ENT_QUOTES) . “
\n”;
$lowmsg = strtolower($message);

$headers = “MIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\n”;
$headers .= “From: “” . $names . “” <” . $email . “>\r\n”;
$headers .= "Reply-To: " . $email . “\r\n”;
$message = utf8_decode($message); mail($to, “EMCD - Feedback”, $message, $headers);

if ($message){
echo ‘sent’;
}else{
echo ‘failed’;
}
?>[/php]

I already tryed change :
[php]$headers = “MIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\n”;[/php]

for:
[php]$headers .= “Content-Type: text/plain; charset = “UTF-8”;\n”;
$headers .= “Content-Transfer-Encoding: 8bit\n”;
$headers .= “\n”;[/php]

Here’s jquery code:

[code][/code]

and html code:

[code]



Feedback



What is your name?







Where can we email you back?



						<h6 id="email-required"></h6></p><br/>
						<p>What's on your mind?</p>
						<p><br/>
						<textarea class="contact-commnent" name="comments"></textarea>
						<h6 id="comment-required"></h6></p><br/>

						<p id="p-submit">
						<input id="submit-form" class="submit-button" name="submit" type="submit" value="Submit"></p>
					</form>
                </div>[/code]

and in this case does not even send message

[size=10pt]Please help me that would appreciate !![/size]

idk if this goes for the object oriented way of php coding, but I’ve been taught that if you are using echo to print a " you need to add a \ before the " so it understands that it shouldnt end the print, but print out the " instead.

To summarize, try doing it like this <"> and see if that works

Justsi is correct. You should look at the “AddSlashes” and “StripSlashes” functions of PHP.

Here is a link for you to read up on it:
http://php.net/manual/en/function.addslashes.php

Sponsor our Newsletter | Privacy Policy | Terms of Service