[eluser]Unknown[/eluser]
dear all i have the following
controller
<?php
class Admin extends CI_Controller {
function __constructor(){
parent::__constructor();
} //constructor ended
public function index(){
$this->load->view('adminV');
} //index function ended
public function administrator(){
$this->load->model('admin_model','',TRUE);
$rzlt =$this->admin_model->login();}
}
?>
and have the following view
<html>
<head>
</head>
<body>
<form action="<?php echo base_url();?>admin/administrator" method="post" name="form">
<label> UserName</label>
<input type="text" name="un" />
<label> Password </label>
<input type="password" name="pass" />
<input type="submit" value="submit" name="submit" />
</form>
</body>
</html>
and model in the following as well
<?php
class Admin_model extends CI_Model{
function __construct(){
parent::__construct();
}
public function db(){
echo "i m admin";
}
public function login(){
require "db.php";
$all = "SELECT * FROM admin"; //getting all data from the user
$use = $_POST['un'];
$pas =$_POST['pass'];
$sub = $_POST['submit'];
$rzlt= mysql_query($all);
while ($show = mysql_fetch_array($rzlt))
{
if($show['username']==$use && $show['password']==$pas)
{
echo "you are logged in as administrator";}
else
{
echo "plz try again to login";
}
}
}
}
?>
and my other file of db contain the database connectivity only. after run this code m intnimate that the un, pas and submit are not defined.
any body is there to help me in this regard..
thnx in advance