$_POST is empty data in PHP [duplicate]
- I ran this form on my server and it worked with no problems.
- I copied the form onto
test.php
- Sent formdata to
test2.php
- Displayed output with
var_dump($_POST)
Changed:
action="/add"
(which looks like a directory to me by the way)To:
action="test2.php"
Which Produced the following output:
array(1) { ["form"]=> array(9) { ["name"]=> string(0) "" ["description"]=> string(0) "" ["date"]=> string(0) "" ["hr"]=> string(0) "" ["min"]=> string(0) "" ["ampm"]=> string(2) "am" ["email"]=> string(0) "" ["zipcode"]=> string(0) "" ["radius"]=> string(0) "" } }
Try sending output to a different script i.e "test2.php"
I read you commented: "No change. I'm using codeigniter, so I have the standard 301 in an htaccess." somewhere. If you use 301, you are being redirected PERMANENTLY (and sometimes "forever"). Check your browsers response from server (try to preserver log) and see if your post is being redirected. If so, your POST data will be lost.
How to preserve POST data via ajax request after a .htaccess redirect?
<form action="/add"
Change the '/add' part with the target page name: example.php