Welcome Guest, Not a member yet? Register   Sign In
Simple form post unwanted redirection
#1

(This post was last modified: 01-31-2022, 06:08 AM by night_day.)

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();
    }
}
Reply


Messages In This Thread
Simple form post unwanted redirection - by night_day - 01-31-2022, 06:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB