Hello, I am writing a page that will post data, quite simple really. I have got some script that as you type, it iserts HTML behind the scenes, so if you press RETURN it iserts <p> </p> and starts a new paragraph. Heres the page:
Here is the page

THE PROBLEM IS, the page that this data is being posted to comes up with Error 406 (which i believe is means it cant display the page)

I had set this up yesterday, it was working fine, it posted the data to the next page and worked fine. But today i come on and the 406 error comes up.

Whats wrong?? whys this suddenly happend? and how can i fix it?

Here is some example code that works:

<form name="form1" method="post" action="index.php">
                    <input name="content" type="hidden" id="content" value="hello <>">
                    <input type="submit" name="Submit" value="Submit">
    </form>

when clicked, index.php comes up fine

Here is some example code that does NOT work:

<form name="form1" method="post" action="index.php">
                    <input name="content" type="hidden" id="content" value="hello <b>">
                    <input type="submit" name="Submit" value="Submit">
    </form>

when clicked, index.php comes up with the error.
Notice the <> and <b> change make the difference. I could understand that it might not work cos postin html tags, but it was fine yesterday!!!!

Like i said, it worked POSTING charactors like <B> </B> yesterday, no it doesnt.

Look at the page here:
Here is the page

You can try typing into the boxs and view html code behind it.

PLEASE HELP!!!!!!!!

THANKS ALOT

    HTTP Error Code 406 means "Not Acceptable".

    Have you specified any accept headers?

    10.4.7 406 Not Acceptable

    The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.

    Unless it was a HEAD request, the response SHOULD include an entity containing a list of available entity characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice MAY be performed automatically. However, this specification does not define any standard for such automatic selection.

      Note: HTTP/1.1 servers are allowed to return responses which are
      not acceptable according to the accept headers sent in the
      request. In some cases, this may even be preferable to sending a
      406 response. User agents are encouraged to inspect the headers of
      an incoming response to determine if it is acceptable.

    If the response could be unacceptable, a user agent SHOULD temporarily stop receipt of more data and query the user for a decision on further actions.

      Thanks for your reply, what headers do i need to set to make this work?

      Its verry strange that is was workin then stopped without me changing the code at all.

        Try putting:

        header("Content-type: text/html");

        at the top of your script or after session_start if your using sessions).

          Thats not working, its still going to the error page :bemused: could it be something server side that i have to change?

            Does it give you any specific error information other than error code 406?

              This is what it gives me:

              The resource cannot be displayed
              The resource you are looking for cannot be opened by your browser.


              Please try the following:

              Click the Back button to try another link.
              Click Search to look for information on the Internet.

              HTTP Error 406 - Not acceptable
              Internet Explorer

              I have tried it also on a blank html page and the same comes up

              i have tried typing into the address
              http://www.hedcase.co.uk?notwork=<b>

              And thats the error message
              Thanks

                Does it give you this message in other browsers, or just M$IE?

                  I dont have any other browser than IE, i am currently downloadin Netscape, but it errors on IE on other computers wich isnt good! It should work on any browser.

                  Thanks

                    It does the same on Netscape:

                    Not Acceptable
                    An appropriate representation of the requested resource /account/addblog1old.php could not be found on this server.

                    Apache/1.3.33 Server at www.hedcase.co.uk Port 80

                      Hi,

                      is the site located at a hosting company or do you have your own dedicated server ?

                      Please check the web server's error log for any error message. Additionally, create a phpinfo() script and post the output.

                      One reason could be an enabled mod_security module that refuses some of the posted data (e.g. HTML tags or something like that).

                      Please post the PHP code of addblog1old.php.

                      Thomas

                        ...I can see the surce code and no page...

                        Is that just to show us the code or is there something wrong?

                        If that is not the desired behaviour I would suggest that your server is not properly set up so it shows php code instead of parsing it to HTML output like it should...

                        Also, on Firefox the same result for that other link: 406 error...

                        Without any letter between <>'s I get the page, and without anything also, but the 406 when trying any other tag...

                          I think that's caused by the header

                          header("Content-type: text/plain");

                          as suggested by Kudose. That should rather be text/html

                          Thomas

                            ..it is a plain text page which was intended to be HTML page - I wasn't looking really close so I saw a lot of {}'s and I figured they are from PHP part of the code when they are only JS code
                            🙂

                              I just noticed that that site is running PHP 4.3.10.

                              I think that the hoster might have enabled some security setting while upgrading to PHP 4.3.10 (just a shot in the dark).

                              EDIT: ask your hoster if they activated mod_security or changed any mod_security settings.

                              EDIT 2: Seems like the 406 error disappeared. Whatever caused that problem seems to be solved.

                              Thomas

                                Thanks for your post, you were right, the company that hosts my website had changed mod_security settings after making some upgrades and they had forgot to put them back i think.

                                Thanks for your help!

                                http://www.hedcase.co.uk/index.php

                                  Write a Reply...