POST array not getting printed

2019-07-27 15:56发布

I have a php form as follows, where I'm not able to print_r($_POST); It just gives me an empty array as follows

Array()

I have tried replacing the post with get and it works just fine.

Version

PHP version : 7.0.5
Workstation : Windows 10

My HTML form

<html>
<body>

<form action="welcome.php" method="post">
    Name: <input type="text" name="name"><br>
    E-mail: <input type="text" name="email"><br>
    <input type="submit">
</form>

</body>
</html>

My PHP Code

<?php

print_r($_POST);
?>

Printing out phpinfo() gives the following PHP logo PHP Version 7.0.5

System  Windows NT DESKTOP-9CUE6VK 10.0 build 10586 (Windows 10) i586
Build Date  Mar 30 2016 09:57:56
Compiler    MSVC14 (Visual C++ 2015)
Architecture    x86
Configure Command   cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"
Server API  CGI/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   C:\WINDOWS
Loaded Configuration File   C:\Users\aftab\Downloads\php-7.0.5-nts-Win32-VC14-x86\php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed    (none)
PHP API 20151012
PHP Extension   20151012
Zend Extension  320151012
Zend Extension Build    API320151012,NTS,VC14
PHP Extension Build API20151012,NTS,VC14
Debug Build no
Thread Safety   disabled
Zend Signal Handling    disabled
Zend Memory Manager enabled
Zend Multibyte Support  disabled
IPv6 Support    enabled
DTrace Support  disabled
Registered PHP Streams  php, file, glob, data, http, ftp, zip, compress.zlib, https, ftps, phar
Registered Stream Socket Transports tcp, udp, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters   convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*
Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
Configuration

bcmath

BCMath support  enabled
Directive   Local Value Master Value
bcmath.scale    0   0
calendar

Calendar support    enabled
cgi-fcgi

Directive   Local Value Master Value
cgi.check_shebang_line  1   1
cgi.discard_path    0   0
cgi.fix_pathinfo    1   1
cgi.force_redirect  1   1
cgi.nph 0   0
cgi.redirect_status_env no value    no value
cgi.rfc2616_headers 0   0
fastcgi.impersonate 0   0
fastcgi.logging 1   1
Core

PHP Version 7.0.5
Directive   Local Value Master Value
allow_url_fopen On  On
allow_url_include   On  On
arg_separator.input &   &
arg_separator.output    &   &
auto_append_file    no value    no value
auto_globals_jit    On  On
auto_prepend_file   no value    no value
browscap    no value    no value
default_charset UTF-8   UTF-8
default_mimetype    text/html   text/html
disable_classes no value    no value
disable_functions   no value    no value
display_errors  On  On
display_startup_errors  On  On
doc_root    no value    no value
docref_ext  no value    no value
docref_root no value    no value
enable_dl   Off Off
enable_post_data_reading    On  On
error_append_string no value    no value
error_log   no value    no value
error_prepend_string    no value    no value
error_reporting 32767   32767
exit_on_timeout Off Off
expose_php  On  On
extension_dir   ext ext
file_uploads    On  On
highlight.comment   #FF8000 #FF8000
highlight.default   #0000BB #0000BB
highlight.html  #000000 #000000
highlight.keyword   #007700 #007700
highlight.string    #DD0000 #DD0000
html_errors On  On
ignore_repeated_errors  Off Off
ignore_repeated_source  Off Off
ignore_user_abort   Off Off
implicit_flush  Off Off
include_path    .;C:\php\pear   .;C:\php\pear
input_encoding  no value    no value
internal_encoding   no value    no value
log_errors  On  On
log_errors_max_len  1024    1024
mail.add_x_header   On  On
mail.force_extra_parameters no value    no value
mail.log    no value    no value
max_execution_time  30  30
max_file_uploads    20  20
max_input_nesting_level 64  64
max_input_time  60  60
max_input_vars  1000    1000
memory_limit    128M    128M
open_basedir    no value    no value
output_buffering    4096    4096
output_encoding no value    no value
output_handler  no value    no value
post_max_size   60M 60M
precision   14  14
realpath_cache_size 16K 16K
realpath_cache_ttl  120 120
register_argc_argv  Off Off
report_memleaks On  On
report_zend_debug   On  On
request_order   GP  GP
sendmail_from   no value    no value
sendmail_path   no value    no value
serialize_precision 17  17
short_open_tag  Off Off
SMTP    localhost   localhost
smtp_port   25  25
sql.safe_mode   Off Off
sys_temp_dir    no value    no value
track_errors    On  On
unserialize_callback_func   no value    no value
upload_max_filesize 60M 60M
upload_tmp_dir  no value    no value
user_dir    no value    no value
user_ini.cache_ttl  300 300
user_ini.filename   .user.ini   .user.ini
variables_order GPCS    GPCS
windows.show_crt_warning    Off Off
xmlrpc_error_number 0   0
xmlrpc_errors   Off Off
zend.assertions 1   1
zend.detect_unicode On  On
zend.enable_gc  On  On
zend.multibyte  Off Off
zend.script_encoding    no value    no value

Troubleshooting attempts I have tried several methods, some of which include

  1. Turning off magic_quotes_gpc

; Magic quotes for incoming GET/POST/Cookie data. magic_quotes_gpc = Off

  1. Changing the size of post_max_size and upload_max_filesize to 60M (was 8M earlier)

Please advise me on how I can get the POST array to get displayed, and access individual variables.

标签: php post get
0条回答
登录 后发表回答