<?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.
It may be due to rewrite rules in the .htaccess file.Add this condition to your .htaccess file
OR add this line
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.
If you're just refreshing the page, do:
instead of:
Also, add this to line 2 to see what's being stored (if anything) in the $_POST array:
Hmm... so it's empty on submit? Try adding this to the top of your php file:
Okay, now check your php.ini (normally requires sudo or root in /etc):
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:
I solved mine with including following into header.
Just use this in the header while making a request and my problem was solved.
My friend ran into this problem today. The answer was pretty simple - basically, you have to capitalize the
POST
part ofmethod="POST"
The final result should look like
use this instead;