Hi everyone,
I'm starting up with CI4 and things have been going well. I recently implemented MythAuth which has been great as well. Now I am trying to do some simple form submit, but form submits all seem to be redirecting back to another route I have. (character/1)
Routes
Code:
$routes->match(['get', 'post'], 'admin/save', 'Admin::save');
$routes->get('admin', 'Admin::index');
$routes->get('character/(:segment)', 'Character::index/$1');
The route to my admin/save seems to work ok, as I can hit it as I get
array(0) { }
The code on admin/save is simply this right now:
Code:
var_dump($_POST);
die();
The form is very simple too:
Code:
<?php echo form_open('admin/save'); ?>
<input type="text" id="contents" name="deckcontents" value="Hello World" />
<input type="submit" name="savecontents" value="Save" />
<?php echo form_close(); ?>
I am not sure if it's a mythauth thing causing the redirect, but I don't think it is since I can go to admin/save directly. Web Webdev tools up, when I hit the save button it seems to go to admin/save url but then redirects immediately, not sure why that is occuring. Any ideas?
Full controller:
Code:
<?php
namespace App\Controllers;
class Admin extends BaseController
{
public function index()
{
helper('form');
return view('admin/index');
}
public function save()
{
var_dump($_POST);
die();
}
}