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 967559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:20:16+00:00 2026-05-16T02:20:16+00:00

Is it normal for PHP not to decode $_POST sent as application/x-www-form-urlencoded through AJAX?

  • 0

Is it normal for PHP not to decode $_POST sent as application/x-www-form-urlencoded through AJAX?

I want to use urldecode but it gets rid of my + characters. Help?

:

15:51:55.490[755ms][total 755ms] Status: 200[OK]
POST  Load Flags[LOAD_BYPASS_CACHE  LOAD_BACKGROUND  ] Content Size[72] Mime Type[text/html]
   Request Headers:
      Host[]
      User-Agent[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8]
      Accept[text/html, */*]
      Accept-Language[en-us,en;q=0.5]
      Accept-Encoding[gzip,deflate]
      Accept-Charset[ISO-8859-1,utf-8;q=0.7,*;q=0.7]
      Keep-Alive[115]
      Proxy-Connection[keep-alive]
      Content-Type[application/x-www-form-urlencoded; charset=UTF-8]
      X-Requested-With[XMLHttpRequest]
      Content-Length[164]
      Pragma[no-cache]
      Cache-Control[no-cache]
   Post Data:
      id[133]
      content[%253Cp%253E%250A%2509Test%2520test%2520-%2520this%2520will%2520disappear%253A%2520%2B%253C%2Fp%253E%250A]
      title[Plus%2520character%2520not%2520working]
   Response Headers:
      Via[1.1 KIGALI]
      Connection[Keep-Alive]
      Proxy-Connection[Keep-Alive]
      Content-Length[72]
      Date[Mon, 02 Aug 2010 03:51:55 GMT]
      Content-Type[text/html; charset=utf-8]
      Server[Apache/2.2.12 (Ubuntu)]
      X-Powered-By[PHP/5.2.10-2ubuntu6.4]
      Vary[Accept-Encoding]
      Keep-Alive[timeout=15, max=100]
  • 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-16T02:20:17+00:00Added an answer on May 16, 2026 at 2:20 am

    Part of urldecode‘s functionality is to turn + signs into spaces. To get around this, you should urlencode any + signs in your string, so they turn into %2B

    So:

    <?php
    $theTag = 'c++';
    urldecode($theTag);
      // output is "c  "
    $theTag = urlencode($theTag);
    urldecode($theTag);
      // output is "c++"
    ?>
    

    Now, the superglobals $_GET and $_REQUEST are already decoded. Using urldecode() on an element in $_GET or $_REQUEST could have unexpected and dangerous results. I’m not sure about $_POST. But it well may be decoded too.


    From your question, I’m not sure exactly what you’re dealing with, but looking over the comments on urldecode in the PHP manual, here is a comment you may be interested in:

    It's worth pointing out that if you are using AJAX and need to encode strings that are being sent to a PHP application, you may not need to decode them in PHP.

    <?php
    echo stripslashes(nl2br($_POST['message']));
    ?>
    

    Will properly output a message sent with the javascript code if the message is encoded:

    message = encodeURIComponent(message)
    

    And is sent with an AJAX POST request with the header:

    ajaxVar.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that's generated by a normal PHP loop. What I want
In PHP, I am able to use a normal function as a variable without
Under normal circumstances, a VB.NET application of mine can check the ClientName environmental variable
What is the normal way people writing network code in Delphi use Windows-style overlapped
Consider a normal customer-orders application based on MVC pattern using WinForms. The view part
I am writing a add-on module which is integrated with an existing PHP application;
I will explain more, because it might not be clear enough I want to
I am trying to use php. I wrote a small script as instructed in
My normal work flow to create a new repository with subversion is to create
Sometimes normal FTP doesn't quite cut it... When you need to do secure FTP

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.