PHP POST not working

$_post in php
php post to url
form method=post not working
php _post array
get works but post does not
php post request
php get all post data
using post in php
<?php echo $_POST['ss'];?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<input name="ss" type="text" />
<input type="submit" name="submit">
</form>

This code should print whatever is enter in text box name="ss" when click submit. But its not printing. Working with method="get" but not with post, What's the problem.

If you're just refreshing the page, do:

action=''

instead of:

action="<?php echo $_SERVER['PHP_SELF'];?>"

Also, add this to line 2 to see what's being stored (if anything) in the $_POST array:

var_dump( $_POST );

Hmm... so it's empty on submit? Try adding this to the top of your php file:

if(empty($_SERVER['CONTENT_TYPE']))
{ 
  $_SERVER['CONTENT_TYPE'] = "application/x-www-form-urlencoded"; 
}

Okay, now check your php.ini (normally requires sudo or root in /etc):

post_max_size = 8M
variables_order = "EGPCS"

Do you have those two rules set? If so, be careful of how much memory you're allocating. Anything over 2048MB could start to give you trouble, depending on your system specs.

NOTE: If you make changes to your php.ini file and PHP is running as an apache module, you'll need to restart apache. Something along the lines of:

sudo /etc/init.d/httpd restart

Form $_POST Data Not Working - Community support, Hi, I have a script that is not working on here, but it works everywhere else. The post data is not being recognized. Heres an example: <?php  A few thing you could do: Make sure that the "action" attribute on your form leads to the correct destination. Try using $_REQUEST[] instead of $_POST, see if there is any change. [Optional] Try including both a 'name' and an 'id' attribute e.g.

I broken my post method once that I set post_max_size the same with upload_max_filesize.

I think that post_max_size must less than upload_max_filesize. Tested with PHP 5.3.3 in RHEL 6.0

$_POST not working, but $_GET is working. WHY?!, Here's the sample code, starting with $_POST that doesn't work: HTML FORM: <​html> <body> <form action="welcome.php" method="post"> This is not turned on by default and is frowned upon because it makes it difficult to embed XML processing instructions into an XML PHP document. $_POST should however always work. I recommend that you replace the custom script with one which simply executes phpinfo() to determine exactly which predefined variables are set.

It may be due to rewrite rules in the .htaccess file.Add this condition to your .htaccess file

RewriteCond %{REQUEST_METHOD} !POST [NC]

OR add this line

 RewriteRule ^welcome_post.php - [PT]

php, hi Dear, in form tag action is missing so put <form method="POST" action="index.​php">. hope it works for you. Im trying to POST data entered by a user into my databse however my if statement to make sure this only happens once the submit button has been pressed is not working. Please help! code below.. &lt;

My friend ran into this problem today. The answer was pretty simple - basically, you have to capitalize the POST part of method="POST"

The final result should look like

<?php echo $_POST['ss'];?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<input name="ss" type="text" />
<input type="submit" name="submit">
</form>

PHP: $_POST, $HTTP_POST_VARS contains the same initial information, but is not a superglobal. If you are referring to your element ID in the POST array, it won't work. This tutorial will cover how PHP handles form data posted via the POST method. # Introduction to the form. POST data is submitted by a form and "posted" to the web server as form data. POST data is encoded the same way as GET data, but isn't typically visible to the user in standard browsers.

First make sure that your web service (GET/POST etc) is acting as desired using the Chrome Advanced Rest Client. Then you should check your PHP part.

Using the POST method in a PHP form, This tutorial will cover how PHP handles form data posted via the POST You can use the "isset" function on any variable to determine if it has been set or not. One way to think of it is like this: element "id=" is for CSS, while element "name=" is for PHP. If you are referring to your element ID in the POST array, it won't work. You must assign a name attribute to your element to reference it correctly in the POST array.

[RESOLVED] $_GET works but $_POST does not work, I am currently following along in a text about PHP access to SQL DB's by Kevin Yank. I am running MYSQL 5.xx on a IIs 5 server in Win XP. No you have done the right thing, when testing you used a simplified form in order to isolate the problem down to the lowest denominator 'POST'. and saw it wasn't working. Without going further into your code there I would just say that if the 'test' form won't work at the simplest level, neither will the more complicated.

PHP: Working with Post Variables. A small problem, hopefully , My PHP: <?php var_dump($_POST); $name = $_POST["name"]; $email = $_​POST["email"]; Hi all this one is also not working for me. Find answers to php $_POST not working from the expert community at Experts Exchange

PHP $_POST, Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java  hi, I am using simple jquery post but its not working , i checked in firebug but there is no error. Please checked and help. code----

Comments
  • What do you see when you print_r($_POST);?
  • Why are you using $_SERVER['PHP_SELF'], when you could leave the action attribute empty if you want it to submit to itself?
  • Looks ok to me, what does print_r($_POST) show you?
  • i would guess the php_self tag is mucking things up and forcing a 302
  • Wasim, are you getting any errors? If not, try adding ini_set('display_errors',1); error_reporting(E_ALL); This will let you see if anything else is stopping your success.
  • What does the var_dump say? array(0)?
  • i did print_r($_POST), when first time page load its say Array() but when i submit, nothing in array.
  • Its not working answer is useless. Var dump as matthew has said and tell us the results.
  • Hmmm... Okay. Did you set up php yourself? Check my edited answer.
  • @Wasim Change to more then 8MB.