Re: PHP has no $_POST values

[email protected] (Andrey Repin)
Newsgroups php.general
Message-ID <[email protected]>
Greetings, [email protected].
In reply to Your message dated Saturday, February 20, 2021, 1:54:17,

> Ive got an odd situation. Ive been developing a new page / section to
> my website (PHP / PHP Smarty templates)

> A week ago, it was working fine for this particular script, But today
> when i revisit it, there's NO $_POST values being received by the
> script at all.

1. Check with a simple form.
2. Post example code.
3. Did you change webserver settings?

If you are using Apache httpd, there's at least 3 ways to activate PHP, which one
did you choose?

> Other scripts in the same directory, work fine. Ive created a
> sub-directory and moved the scripts (included files & main script for
> the one I'm working on) into the subdirectory and still no $_POST
> values.

> The top of my script looks like this (no other information or processing)

Irrelevant, $_POST array is filled before your script started.

> error_reporting(E_ALL);
> ini_set('display_errors', TRUE);
> ini_set('display_startup_errors', TRUE);

Set this in your virtual server configuration, and set it to more sensible
values than this.

php_admin_value error_reporting -1
php_flag display_errors on
php_flag display_startup_errors on

>  echo "<pre>1\n".print_r($_POST,true)."</pre>\n";

> RESULT = a blank/empty array.  Other scripts in the directory (now
> parent directory) work fine.

> Does anyone have ideas on what may be preventing the POST values ?

Server misconfiguration or code mistake.
Test with a simple curl call

curl --form "name=value" http://localhost/yourscript.php

> PS the htaccess file only contains 2 lines :-

> RewriteEngine on

If you are not writing any rules, why enable it at all?
Not to mention, it is often useless and the problem can be resolved entirely
without it.

> DirectoryIndex provisional.php

> QUESTION 2:- Are there any instructions on how to use this php forum ?
> I'm getting NO information at the footer of these messages - archive ?
> how to change settings etc ?

Just use a sane newsreader client.


-- 
Sincerely Yours, Andrey Repin <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.