Special signs in contact form
Results 1 to 4 of 4

Thread: Special signs in contact form

  1. #1
    Junior Member
    Join Date
    Apr 2012

    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 Code:
    $email $_POST['email_address'];
    $comment $_POST['comment'];
    $to ='szymondziewonski@gmail.com';
    $message "";
    $message .= "Name: " htmlspecialchars($namesENT_QUOTES) . "<br>\n";
    $message .= "Email: " htmlspecialchars($emailENT_QUOTES) . "<br>\n";
    $message .= "Comment: " htmlspecialchars($commentENT_QUOTES) . "<br>\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 (
    I already tryed change this code :

    PHP Code:
    $headers "MIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\n"
    PHP Code:
    $headers .= "Content-Type: text/plain; charset = \"UTF-8\";\n";
    $headers .= "Content-Transfer-Encoding: 8bit\n";
    $headers .= "\n"
    and in this case does not even send message

    Here's Ajax code:

     	 var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
     	 var names 				 = $('#contact-form [name="contact-names"]').val();	 
       var email_address = $('#contact-form [name="contact-email"]').val();
       var comment			 = $.trim($('#contact-form .contact-commnent').val());
       var data_html ='' ;
     				if(names == ""){
     					 $('#name-required').html('Your name is required.');
     				if(email_address == ""){
     					 $('#email-required').html('Your email is required.');
     				}else if(reg.test(email_address) == false){
     					 $('#email-required').html('Invalid Email Address.');
     				if(comment == ""){
     					 $('#comment-required').html('Comment is required.');
     		if(comment != "" && names != "" && reg.test(email_address) != false){
     			data_html = "names="+ names + "&comment=" + comment + "&email_address="+ email_address;
    				  type: 'POST',
    				  url: 'contact-send.php',
    				  data: data_html,
    				  success: function(msg){
    				  	if (msg == 'sent'){
    				 			$('#success').html('Message sent!') 	;
    				 			$('#contact-form [name="contact-names"]').val('');	 
    						  $('#contact-form [name="contact-email"]').val('');
        					$('#contact-form .contact-commnent').val('');
            $('#success').html('Mail Error. Please Try Again.!')  ; 
       return false;

    Here's html code:
    HTML Code:
    <div class="form-wrapper">
    						<h1 id="success"></h1>
    						<form id="contact-form" name="contact-form" method="POST">
    							<p>What is your name?</p><br/>
    							<p><input type="text" value="" name="contact-names" class="contact-names"/>
    							<h6 id="name-required"></h6><br/>
    							<p>Where can we email you back?</p><br/>
    							<p><input type="text" value="" name="contact-email" class="contact-email"/>
    							<h6 id="email-required"></h6></p><br/>
    							<p>What's on your mind?</p>
    							<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>

    Would be appreciate if u could help !

  2. #2
    Senior Member anoopmail's Avatar
    Join Date
    May 2005
    Fact 1: The bigger you posted code, the lesser the replies
    Do you really need utf8_decode() function call?

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Thank you, for you reply.
    I am new at PHP code, I have no idea if this is problem have utf8_decode()

    What do u suggest?
    I just want signs that UTF-8 support.

    Please help me with that problem. Cuz seems no1 know how this code edit ..

  4. #4
    Senior Member anoopmail's Avatar
    Join Date
    May 2005
    let's try by removing utf8_decode() function call.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts