Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6529565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:39:04+00:00 2026-05-25T09:39:04+00:00

I’m trying to create and submit a form for a website and send a

  • 0

I’m trying to create and submit a form for a website and send a mail after all fields are submitted. The data is submitted through ajax calls.

The problem is that my site users work in UTF-8 and if I submit the form with Internet Explorer the info (from the form) is not sent in UTF-8 unless i do utf8_encode(). But if i send the email using the ut8_encode function Firefox and Chrome stops working…

Some notes:
– The php file containing the form has header in UTF-8
– meta-tag UTF-8
– In the ajax.php (file where the form is submitted) also has header in UTF-8
– Email headers are received in UTF-8 charset (independent of the browser)

Code:
ajax.php

$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$reply = $_REQUEST['reply'];

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: '.$email . "\r\n" .
'X-Mailer: PHP/' . phpversion();

$topic = 'subject';
$message = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body style="font-size:11px; font-family:Verdana, sans-serif; line-height:17px;">
    <h1 style="color:#255670; font-size:16px; font-family: \'Trebuchet MS\', sans-serif; text-transform:uppercase;">Quizz</h1>
    <div style="background-color:#EFEFEF; padding:10px;">
        Nome: <b>'.$name.'</b><br />
        Telefone: <b>'.$phone.'</b><br />
        E-mail: <a href="mailto: '.$email.'"><b>'.$email.'</b></a><br />
    </div>
    <div style="border-top:1px dashed #8CD3D7; padding:5px; margin:10px 0px 0px 0px;">
        <p>'.$reply.'</p>
    </div>
</body></html>';

$sendMail = mail($adminMail, $topic, $message, $headers);

index.php (form)

<form method="GET" enctype="text/plain" accept-charset="utf-8">
<div class="banner-subtitle">Resposta:</div>
<textarea name="reply" id="quizz-reply" style="width:255px;"></textarea>
<div class="banner-subtitle">%NAME%:</div>
<input type="text" id="quizz-name" class="required" name="name" style="width:255px;"/>

<div class="banner-subtitle">%PHONE%:</div>
<input type="text" id="quizz-phone" class="required" name="name" style="width:255px;"/>
<div class="banner-subtitle">%EMAIL%:</div>
<input type="text" id="quizz-email" class="required" name="email" style="width:255px;"/>
<div class="banner-subtitle">%SECURITY_CODE%:</div>
<img style="float:left; margin-right:10px" src="ajax.php?action=generateCaptcha&width=80&height=20&cell=security_code2"/><input type="text" id="quizz-security-code" class="required" name="security_code2" style="width:80px; float:left"/>
<input type="button" value="%SUBMIT%" onclick="sendOpinion()" style="margin-top: 1px"/>
</form>

Ajax Request

$.ajax({
                    url:'ajax.php?action=sendOpinion&name='+name+'&email='+email+'&phone='+phone+'&passport='+passport+'&reply='+reply,
                    success: function(data)
                    {
                            //alert(data);
                            $('#quizz-name').val('');
                            $('#quizz-email').val('');
                            $('#quizz-phone').val('');
                            $('#quizz-passport').val('');
                            $('#quizz-reply').val('');
                    }
                });

Can anyone please help? I can’t understand what I’m doing wrong…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:39:04+00:00Added an answer on May 25, 2026 at 9:39 am

    Declare the encoding of your website; add this in your <head> tag:

    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    

    BTW you should escape your variables, even in emails:

    Nome: <b>'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').'</b><br />
    

    And in URLs too:

    url:'ajax.php?action=sendOpinion&name='+encodeURIComponent(name)+'...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a text area in my form which accepts all possible characters from
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.