Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] - Strange problem with POST data
#5

(This post was last modified: 09-23-2020, 03:30 AM by Matleyx.)

(09-23-2020, 02:49 AM)nc03061981 Wrote: error Logic

First

var_dump($_POST);

die();

to see your post info

No need 2 lines:
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\Response;

Only use:
$request = \Config\Services::request();

and Form action, you should leave empty to post to current Controller

<form action="test" method="post">

to

<form action="" method="post">


I added a new public function in controller with name "return" where i put var_dump($_POST); and die();
I change the action in form to test/return.

the response:


Code:
array(0) { }

I have never had all these problem in my php experience.......


For information, i testing my apache and php with this simple index.php file:
Code:
<?php
if (isset($_POST['submit'])) {
    if (isset($_POST['name'])) {
        echo "Nome: ".$_POST['name']."<br>";
    }
   
    if (isset($_POST['lastname'])) {
        echo "Cognome: ".$_POST['lastname'];
    }
} else {
?>
<form action="/" method="post">
    <input type="text" name="name" value="Mario">
    <input type="text" name="lastname" value="Rossi">
    <input type="submit" name="submit" value="submit">
</form>
<?php
}
?>

The output, after submit is:
Code:
Nome: Mario<br>Cognome: Rossi

The post data work fine OUTSIDE Codeigniter.......
Is there a limitation?
I there a flag that i don't know?
this is my .env file, if necessary (i'm in development environmental):
Code:
#--------------------------------------------------------------------
# Example Environment Configuration file
#
# This file can be used as a starting point for your own
# custom .env files, and contains most of the possible settings
# available in a default install.
#
# By default, all of the settings are commented out. If you want
# to override the setting, you must un-comment it by removing the '#'
# at the beginning of the line.
#--------------------------------------------------------------------

#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------

CI_ENVIRONMENT = development

#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

# app.baseURL = ''
# app.forceGlobalSecureRequests = false

# app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'
# app.sessionCookieName = 'ci_session'
# app.sessionSavePath = NULL
# app.sessionMatchIP = false
# app.sessionTimeToUpdate = 300
# app.sessionRegenerateDestroy = false

# app.cookiePrefix = ''
# app.cookieDomain = ''
# app.cookiePath = '/'
# app.cookieSecure = false
# app.cookieHTTPOnly = false

# app.CSRFProtection  = false
# app.CSRFTokenName  = 'csrf_test_name'
# app.CSRFCookieName  = 'csrf_cookie_name'
# app.CSRFExpire      = 7200
# app.CSRFRegenerate  = true
# app.CSRFExcludeURIs = []

# app.CSPEnabled = false

#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------

database.default.hostname = 127.0.0.1
database.default.database = ci4-test2
database.default.username = ci4-test2
database.default.password = ci4-test2
database.default.DBDriver = MySQLi

# database.tests.hostname = localhost
# database.tests.database = ci4
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi

#--------------------------------------------------------------------
# CONTENT SECURITY POLICY
#--------------------------------------------------------------------

# contentsecuritypolicy.reportOnly = false
# contentsecuritypolicy.defaultSrc = 'none'
# contentsecuritypolicy.scriptSrc = 'self'
# contentsecuritypolicy.styleSrc = 'self'
# contentsecuritypolicy.imageSrc = 'self'
# contentsecuritypolicy.base_uri = null
# contentsecuritypolicy.childSrc = null
# contentsecuritypolicy.connectSrc = 'self'
# contentsecuritypolicy.fontSrc = null
# contentsecuritypolicy.formAction = null
# contentsecuritypolicy.frameAncestors = null
# contentsecuritypolicy.mediaSrc = null
# contentsecuritypolicy.objectSrc = null
# contentsecuritypolicy.pluginTypes = null
# contentsecuritypolicy.reportURI = null
# contentsecuritypolicy.sandbox = false
# contentsecuritypolicy.upgradeInsecureRequests = false

#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------

# encryption.key =
# encryption.driver = OpenSSL

#--------------------------------------------------------------------
# HONEYPOT
#--------------------------------------------------------------------

# honeypot.hidden = 'true'
# honeypot.label = 'Fill This Field'
# honeypot.name = 'honeypot'
# honeypot.template = '<label>{label}</label><input type="text" name="{name}" value=""/>'
# honeypot.container = '<div style="display:none">{template}</div>'
Reply


Messages In This Thread
RE: Strange problem with POST data - by Matleyx - 09-23-2020, 02:36 AM
RE: Strange problem with POST data - by Matleyx - 09-23-2020, 03:08 AM
RE: Strange problem with POST data - by Matleyx - 09-23-2020, 04:17 AM
RE: Strange problem with POST data - by Matleyx - 09-23-2020, 04:40 AM
RE: Strange problem with POST data - by Matleyx - 09-23-2020, 06:30 AM
RE: Strange problem with POST data - by Matleyx - 09-24-2020, 07:46 AM
RE: Strange problem with POST data - by Matleyx - 09-23-2020, 07:16 AM
RE: Strange problem with POST data - by Matleyx - 09-23-2020, 07:26 AM
RE: Strange problem with POST data - by InsiteFX - 09-23-2020, 04:20 PM
RE: Strange problem with POST data - by InsiteFX - 09-24-2020, 08:53 AM
RE: Strange problem with POST data - by Matleyx - 09-24-2020, 10:53 PM
RE: Strange problem with POST data - by Matleyx - 09-25-2020, 02:59 AM
RE: Strange problem with POST data - by Matleyx - 09-25-2020, 06:01 AM
RE: Strange problem with POST data - by Matleyx - 09-25-2020, 11:41 AM
RE: Strange problem with POST data - by Matleyx - 09-25-2020, 01:52 PM
RE: Strange problem with POST data - by InsiteFX - 09-26-2020, 01:15 AM
RE: Strange problem with POST data - by Matleyx - 09-26-2020, 07:02 AM
RE: Strange problem with POST data - by Matleyx - 09-26-2020, 10:42 AM
RE: Strange problem with POST data - by InsiteFX - 09-26-2020, 12:35 PM
RE: Strange problem with POST data - by Matleyx - 09-26-2020, 10:31 PM
RE: Strange problem with POST data - by Matleyx - 09-27-2020, 02:40 AM
RE: Strange problem with POST data - by Matleyx - 09-27-2020, 05:46 AM
RE: Strange problem with POST data - by Matleyx - 09-27-2020, 09:52 AM
RE: Strange problem with POST data - by demyr - 09-27-2020, 01:19 PM
RE: Strange problem with POST data - by Matleyx - 09-28-2020, 12:05 AM
RE: Strange problem with POST data - by Matleyx - 09-28-2020, 02:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB