I have created a form inside the admin section of my website that inserts data into mysql.. and works a charm (its an account creation form). The only problem is that once I press submit it logs me out and returns to the home page of my web app.
This form works fine, the only problem is that on submit it returns home. This is a form in my admin section.. I didn't include the other code as I wouldn't think it has anything relevant to this..
The script you showed us in post #1 has nothing wrong with it,
so the problem has to be in the "rest of the script". You'll have to
show us all of it ... and just remove any user or password (sensitive information).
The website is modular.. There is an admin module which the application hits controller.php (which contains the switches and cases to point the request in the right direction).
I have added a switch in their called password which points it to the password form I have displayed above.
Here is the controller.php:
PHP Code:
<?php
//no direct access
defined( '_OS' ) or die( 'Restricted access' );
check_authentication('admins');
// Including the Model for The pages.
include_once(MODULES_PATH.'admin/models/install.php');
include_once(MODULES_PATH.'admin/models/settings.php');
//Getting params
$action = $_GET['action'];
if(!$id)
{$id = $_GET['id'];}
if(!$view)
{$view = $_GET['view'];}
if(!action)
{;}
//Switching with the view
switch ($view)
{
case "modules":
{
switch ($action)
{
case "list":
$module = list_modules();
include(MODULES_PATH.'admin/views/modules/list.php');
break;
case "install":
include(MODULES_PATH.'admin/views/modules/install.php');
break;
case "uninstall":
if(uninstall_module($id))
{echo 'Module Uninstalled';}
break;
}
}
break;
case "settings":
{
$admin = get_admin();
include(MODULES_PATH.'admin/views/settings/settings.php');
break;
}
break;
case "password":
{
$admin = get_admin();
include(MODULES_PATH.'admin/views/settings/password.php');
break;
}
}
?>
It looks like "view" has to be one of these three: module, settings, password
If "view" is equal to "module", then "action" needs to be: list, install or uninstall
So I would expect the URL to be like:
<form id="form1" name="form1" method="post" action="index.php?view=module&action=create">
BUT ... there is no "create" ... action can only be list, install or uninstall.
I don't see anything in the switch commands for "create". It's like something is missing.