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

  • Home
  • SEARCH
  • 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 9030019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:23:13+00:00 2026-06-16T07:23:13+00:00

I am just calling a simple PHP script through a HTML form. An error

  • 0

I am just calling a simple PHP script through a HTML form.

An error is thrown everytime : “The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol”

I have defined the encoding both in PHP as well as HTML as UTF-8 (please refer to code below). I am unable to solve this problem despite searching all over the web.

HTML code :

<head>
    <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
    <meta content="UTF-8" http-equiv="encoding"/>
    <title>Test</title>
</head>

<body>
    <div align="center">
    <form action= "google1.php" method="get" accept-charset="UTF-8" >
             Enter Your Name:
            <INPUT TYPE = "text" NAME = "student"> <BR>
            <!--input name="q" type="text"-->
            <br/ > 
            <input name="btnG" type="submit"  value ="test">
        </form>
    </div>
</body>

PHP Code

header("Content-type: text/html; charset=UTF-8");
print "<pre>";
print_r($_GET);
print "</pre>";

The result after submitting the button (along with the error) is :

“; print_r($_GET); print “”; ?>

I am using XAMPP. I tried to edit .htaccess (added : AddType ‘text/html; charset=UTF-8’ html) as suggested in some of the solutions over internet but that also did not help.

I found a site where there is a simple form which calls a PHP script again. http://www.tjhsst.edu/~dhyatt/superap/form1.html . When I try to submit value in the form, I get the same error.

So I thought, this could be a browser problem and I changed the default encoding of my browser to UTF-8. But this also did not help.

I am a novice in web programming and trying to learn. Appreciate if any one can help.

Thanks,
Ashutosh

  • 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-06-16T07:23:14+00:00Added an answer on June 16, 2026 at 7:23 am

    It looks like you have some issue with opening/closing tags.

    Ensure that you have php code wrapped with <?php and ?> in your process1.php3 (Some details: http://php.net/manual/en/language.basic-syntax.phpmode.php)
    Like here:

    <?php
       header("Content-type: text/html; charset=UTF-8");
       print "<pre>";
       print_r($_GET);
       print "</pre>";
    ?>
    

    UPD:

    After a long session of question/answer finally appeared that OP were opening file with a form using file:// protocol. Like file:///C:/xampp/htdocs/example/form.html and form were submitted to file:///C:/xampp/htdocs/example/google1.php?... As apache works with HTTP protocol only, PHP were not executed actually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be fairly simple; i'm pretty sure I've just not understood it. FYI,
I have a PHP form that needs some very simple validation on submit. I'd
I have a .php file with HTML code also in it. Through this file
I have a simple cURL script that works just fine. But I'm curious about
I am trying to write a simple PHP script that writes a string to
This should be fairly simple, but it's just not loading for me. Here's my
I'm just creating my own AboutBox and I'm calling it using Window.ShowDialog() How do
On just one page of my site the javascript Date object won't work. Calling
I just started in this SQLAlchemy ORM and I was wondering, if after calling
I'm completely stuck with calling a method from a UIView subclass, the method just

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.