[eluser]Marcone Ramos[/eluser]
Thank you very much Coccodrillo.
I sorry for the mess I did with the code, I should have fixed it before sending and keep it simple so you could see what's my real problem. I'm not a native english speaker so I'll try explain again what's going on.
In the code bellow, when I click ENTRAR, it should be redirected to
Code:
c_loginsyslogin/index/
and execute what's inside of
Code:
if($this->input->post('bntEnter'))
{
echo "It works!";
exit;
}
, but that's not what happens for some reason. it reloads the form page, instead of show the "it works".
I'm posting a simple code again, so it will make easier for you guys to understand what's going on:
C_loginsyslogin
Code:
<?php
class C_loginsyslogin extends CI_Controller{
function index()
{
// LOAD LIBRARIES
$this->load->library(array('encrypt', 'form_validation', 'session'));
// LOAD HELPERS
$this->load->helper(array('form'));
if($this->input->post('bntEnter'))
{
echo "It works!";
exit;
}
$loadTemp['varContent']='v_loginsyslogin';
$this->load->view('v_admintemplate', $loadTemp);
}
}
/* End of file main.php */
/* Location: ./application/controllers/main.php */
?>
v_loginsyslogin
Code:
<?php if($this->session->flashdata('message')) : ?>
<p><?=$this->session->flashdata('message')?></p>
<?php endif; ?>
<? $attributes=array('name' => 'formLogin','class' => 'formLogin', 'enctype' => 'application/x-www-form-urlencoded'); ?>
<?=form_open('c_loginsyslogin/index/', $attributes)?>
<p>Por favor, identifique-se:</p>
<p>
<?=form_label('Login:', 'user_name')?>
<?
//echo form_error("txtusername");
$formBuildingData= array(
'type' => "text",
'name' => "txtusername",
'class' => "normalText",
'size' => "25"
);
?>
<?=form_input($formBuildingData)?>
</p>
<p>
<?=form_label('Senha:', 'user_pass')?>
<?
//echo form_error("txtpasswordd");
$formBuildingData2= array(
'type' => "password",
'name'=> "txtpassword",
'class' => "normalText",
'size' => "25"
);
?>
<?=form_password($formBuildingData2)?>
</p>
<p>
<?
$formBuildingData3=array(
'type' => "submit",
'name' => "bntEnter",
'class'=> "buttonNormal",
'value'=> "Entrar"
);
?>
<?=form_submit($formBuildingData3)?>
</p>
<?=form_close();?>
and this is the main template
Code:
<!doctype html>
<html>
<?
$this->load->helper('html');
echo link_tag('CSS/adminsys.css'); ?>
<head>
<title><!-- navigation --></title>
</head>
<body>
<nav>
</nav>
<section id="maincontent">
<?
$this->load->view($varContent);
?>
<article class="blogPost">
<header>
</header>
</article>
</section>
<footer>
<!-- footer -->
</footer>
</body>
</html>