(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:
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>'