0

I'm using the latest CodeIgniter3.1 Version in my project. When I submit the form or use an AJAX call, I always get an empty $this->input->post('XYZ'). It works on my local machine, but not on the server.

The csrf_protection is set to FALSE and a .htaccess file does exist

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
 ErrorDocument 404 /index.php
</IfModule>

Here is my Form Code, it doesn't matter if i use "form_open" or use it directly like this, it only works on my local dev machine:

<form method="post" id="login_form" action="/index.php/login">
 <label for="email"><?php echo $this->lang->line('username'); ?> *</label>
 <input type="text" name="email" id="email" class="logfeld" autocomplete="username" />
 <label for="passwort"><?php echo $this->lang->line('password'); ?> *</label>
 <input type="password" name="passwort" id="passwort" class="logfeld" autocomplete="current-password" />
 <input class="sendbut" type="submit" name="login" value="<?php echo set_value('passwort'); ?>" />
 </form>

How can I fix that problem?

asked Mar 7, 2019 at 6:32
3
  • mention your local machine code Commented Mar 7, 2019 at 6:45
  • Can you post your form code here? Commented Mar 7, 2019 at 7:56
  • show us your controller code Commented Mar 7, 2019 at 12:42

1 Answer 1

1

i think you should use this method :

$pos = $this->input->post();
 if(isset($pos['XYZ']))$xyz = $pos['XYZ'];else $xyz='';
answered Mar 7, 2019 at 8:39
Sign up to request clarification or add additional context in comments.

3 Comments

The $pos array and $pos['XYZ'] is always empty.
what me thod are you using for post method ?
i think the problems is in here <form method="post" id="login_form" action="/index.php/login"> try change to <form method="post" id="login_form" action="/login">

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.