Not outputting form error messages - php

I have a form that is not outputting any error messages have I missed something?
Model:
function createUser($username = NULL ,$passwordHash = NULL ,$firstname = NULL ,$lastname = NULL ,$email = NULL,$group = NULL ,$active = NULL)
{
$data = array('userName' => $username, 'userFirstName' => $firstname, 'userLastName' => $lastname, 'userEmail' => $email, 'userPassword' => sha1($passwordHash), 'userGroup' => $group, 'userActive' => $active);
$this->db->insert('users',$data);
return TRUE;
}
View:
<h1><?php echo $companyName; echo nbs(1);?> - <?php echo $pageTitle; ?></h1>
<?php
if($success == TRUE) {
echo '<section id = "validation">Page Updated</section>';
}
?>
<p>Error: <?php echo validation_errors();?> </p>
<div class="formContent">
<form action="createUser" method="post">
<fieldset class="control-group">
<label for="userName">User Name: <input type="text" name="userName" value="<?php echo set_value('userName'); ?>" placeholder="User Name"></label>
<label for="userPassword">User Password: <input type="password" name="userPassword" value="<?php echo set_value('userPassword'); ?>" placeholder="User Password"></label>
<label for="userFirstName">First Name: <input type="text" name="userFirstName" value="<?php echo set_value('userFirstName'); ?>" placeholder="First Name"></label>
<label for="userLastName">Last Name: <input type="text" name="userLastName" value="<?php echo set_value('userLastName'); ?>" placeholder="Last Name"></label>
<label for="userEmail">E-Mail: <input type="text" name="userEmail" value="<?php echo set_value('userEmail'); ?>" placeholder="Admin E-mail"></label>
<label for="userGroup"> User Group:
<select name="userGroup" value="<?php echo set_value('userGroup'); ?>">
<option value="select">Please Select</option>
<option value="admin">Admin Group</option>
<option value="user">User Group</option>
</select>
</label>
<label for="userActive"> User Active:
<select name="userActive" value="<?php echo set_value('userActive'); ?>">
<option value="select">Please Select</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</label>
<button type="submit" class="btn-primary">Create</button>
</fieldset>
</form>
</div>
Controller:
public function index()
{
$data['companyName'] = $this->core_model->companyName();
$data['success'] ="";
$data['pageTitle'] = "Create User";
$this->load->view('admin/assets/header', $data);
$this->load->view('admin/createUser', $data);
$this->load->view('admin/assets/footer');
if($this->input->post('submit'))
{
$this->form_validation->set_rules('userName', 'User Name', 'trim|required|xss_clean|callback_username_check');
$this->form_validation->set_rules('userPassword', 'User Password', 'trim|required|xss_clean|sha1');
$this->form_validation->set_rules('userFirstName', 'First Name', 'trim|required|xss_clean');
$this->form_validation->set_rules('userLastName', 'Last Name', 'trim|required|xss_clean');
$this->form_validation->set_rules('userEmail', 'E-Mail', 'trim|required|xss_clean');
$this->form_validation->set_rules('userGroup', 'User Group', 'trim|required|xss_clean');
$this->form_validation->set_rules('userActive', 'User Active', 'trim|required|xss_clean');
if ($this->form_validation->run() == FALSE) {
$data['companyName'] = $this->core_model->companyName();
$data['success'] ="";
$data['pageTitle'] = "Create User";
$this->load->view('admin/assets/header', $data);
$this->load->view('admin/createUser', $data);
$this->load->view('admin/assets/footer');
}else{
$username = $this->input->post('userName',TRUE);
$password = $this->input->post('userPassword', TRUE);
$firstname = $this->input->post('userFirstName', TRUE);
$lastname = $this->input->post('userLastName',TRUE);
$email = $this->input->post('userEmail',TRUE);
$group = $this->input->post('userGroup',TRUE);
$active = $this->input->post('userActive', TRUE);
$this->db->escape($username);
$this->db->escape($password);
$this->db->escape($firstname);
$this->db->escape($lastname);
$this->db->escape($email);
$this->db->escape($group);
$this->db->escape($active);
$passwordHash = $this->encrypt->sha1($password);
if ($this->core_model->createUser($username,$passwordHash,$firstname,$lastname,$email,$group,$active))
{
$data['success'] = TRUE;
$data['companyName'] = $this->core_model->companyName();
$data['pageTitle'] = "Create User";
$this->load->view('admin/assets/header', $data);
$this->load->view('admin/createUser', $data);
$this->load->view('admin/assets/footer');
}else{
$data['companyName'] = $this->core_model->companyName();
$data['pageTitle'] = "Create User";
$this->load->view('admin/assets/header', $data);
$this->load->view('admin/createUser', $data);
$this->load->view('admin/assets/footer');
}
}
}
}
function __username_check($userName){
{
if ($userName == $user->$userName) {
$this->form_validation->set_message('username_check','Sorry the chosen username %s is taken!');
return false;
}else{
return true;
}
}
}
}
/* End of file login.php */
/* Location: ./application/controllers/admin/createUser.php */

You need to place the <input>s outside the <label> </label> tags! This is the main issue.
Also:
there's no input named "submit": your submit button, in fact, has no name attribute. And, btw, since you're already using form_validation class, that check (if input->post('submit')) is redundant;
Another redundant thing I see is passing TRUE (i.e., having it xss_cleaned) to the input->post method: you already have plenty of xss_clean validation rules, so why passing it again in that expensive extra processing, when already passed through it during validation check?
Sidenote, if you're using Active Record, or query bindings, you don't have to escape variables, so I'd remove that part too :)
And I believe your call to __username_check() will fail: the function, as for what concern the "callback_" validation rule, is "username_check"; and besides the double underscore is usually used for "magic methods" in PHP; you can safely remove both, or if you really want an underscore on the function name (just one) you might want to call "callback__check_username".
And you're loading the same views three times, why? I believe you can rewrite the whole index method like this:
function index()
{
$this->form_validation->set_rules('userName', 'User Name', 'trim|required|xss_clean|callback_username_check');
$this->form_validation->set_rules('userPassword', 'User Password', 'trim|required|xss_clean|sha1');
$this->form_validation->set_rules('userFirstName', 'First Name', 'trim|required|xss_clean');
$this->form_validation->set_rules('userLastName', 'Last Name', 'trim|required|xss_clean');
$this->form_validation->set_rules('userEmail', 'E-Mail', 'trim|required|xss_clean');
$this->form_validation->set_rules('userGroup', 'User Group', 'trim|required|xss_clean');
$this->form_validation->set_rules('userActive', 'User Active', 'trim|required|xss_clean');
if ($this->form_validation->run() == FALSE) {
$data['success'] ="";
}else{
$username = $this->input->post('userName');
$password = $this->input->post('userPassword');
$firstname = $this->input->post('userFirstName');
$lastname = $this->input->post('userLastName');
$email = $this->input->post('userEmail');
$group = $this->input->post('userGroup');
$active = $this->input->post('userActive');
$passwordHash = $this->encrypt->sha1($password);
if ($this->core_model->createUser($username,$passwordHash,$firstname,$lastname,$email,$group,$active))
{
$data['success'] = TRUE;
}
}
$data['companyName'] = $this->core_model->companyName();
$data['pageTitle'] = "Create User";
$this->load->view('admin/assets/header', $data);
$this->load->view('admin/createUser', $data);
$this->load->view('admin/assets/footer');
}
UPDATE:
as for the username check, since v.2.0 of CodeIgniter you have that ability featured among the validation rules: if you place the is_unique rule, in fact, it will automatically query the database to check for that. The syntax is:
is_unique[table.field]
In your case, might be
$this->form_validation->set_rules('userName', 'User Name', 'trim|required|is_unique[users.userName]|xss_clean');

Related

codeigniter how to submit multiple rows with the same name

I have tried the following model view controller but i need to submit multiple rows at a time: please can any one help me how to achieve this?
this is my controller:
function add_item(){
$this->form_validation->set_rules('item_name', 'Item Name', 'trim|required');
if ($this->form_validation->run() == FALSE)
{
$this->load->model('mdl_item');
$data['main_content'] = 'backend/items/add_item';
$data['title'] = 'Create item';
$this->load->view('includes/template', $data);
}
else
{
$this->load->model('mdl_item');
$data = $this->input->post();
$this->mdl_item->create_item($data);
$this->session->set_flashdata('message', 'Items successfully created');
redirect('admin/items', 'refresh');
}
}
this is my model:
function create_item($data)
{
$data['expiry_date'] = date('Y-m-d', strtotime(element('expiry_date', $data)));
$crop_data = elements(array(
'item_name',
), $data);
$add_item = $this->db->insert_string('items', $crop_data);
$this->db->query($add_item);
}
this is my View:
<?php echo form_open('admin/items/add_item', 'id="item_form_validate"'); ?>
<div class="col-sm-12 col-md-12 jumbotron">
<input type="text" class="form-control" name="item_name[]" value="<?php echo set_value('item_name'); ?>">
<input type="text" class="form-control" name="item_name[]" value="<?php echo set_value('item_name'); ?>">
<input type="text" class="form-control" name="item_name[]" value="<?php echo set_value('item_name'); ?>">
<button type="submit" class="btn btn-success" value="submit"><span class="icon-checkmark"></span> <?php echo lang('Submit'); ?></button>
</form>
change the code set_rules('item_name', in Controllers
...
function add_item(){
$this->form_validation->set_rules('item_name', 'Item Name', 'trim|required');
to this set_rules('item_name[]'
...
function add_item(){
$this->form_validation->set_rules('item_name[]', 'Item Name', 'required');
and trim the value after you pass it

Feedback page not responding in codeigniter

I am trying to submit a feedback after logging in the user. The Data in not being inserted in the database nor is it displaying any message if the form is left empty.
This is my controller:
function dashboard(){
$this->load->model('stud_model');
$this->form_validation->set_rules('name','Name', 'required');
$this->form_validation->set_rules('email', 'Email Id', 'required');
$this->form_validation->set_rules('feedback', 'Feedback', 'required');
$data['username'] = $this->session->userdata('username');
if ($this->form_validation->run()) {
$data = array(
'Name' => $this->input->post('name'),
'Email' => $this->input->post('email'),
'Feedback' => $this->input->post('feedback'),
);
$submit = $this->stud_model->insert_feedback($data);
if($submit) {
$this->session->set_flashdata('message', 'Feedback Successfully Submitted !');
redirect('Students/enter');
}else{
$this->session->set_flashdata('message', 'Feedback could not be Submitted !');
redirect('Students/enter');
}
}else{$this->load->View('dashboard', $data);}
}
function enter(){
if ($this->session->userdata('username') != '') {
$data['username'] = $this->session->userdata('username');
$this->load->View('dashboard', $data);
}else{
redirect('Students/log');
}
}
function logout(){
$this->session->unset_userdata('username');
redirect('Students/index');
}
This is my view:
<body>
<h1 align="center">My Dashboard</h1><br><br>
<h3 align="left">Welcome <?php echo $username ?> !</h3>
<form action="http://localhost/ci/index.php/Students/dashboard" align="center">
<?php echo validation_errors(); ?>
<br>
<input type="hidden" name="name" value="<?php echo $username ?>"><br>
Email Id : <br><input type="text" name="email"><br><br>
Feedback:<br><br>
<textarea name="feedback" rows="10" cols="50"></textarea><br><br>
<input type="submit" value="Submit"><br><br>
<?php echo $this->session->flashdata("message"); ?>
Logout
</form>
</body>
This is my Model:
function insert_feedback($data){
$this->load->database();
$this->db->insert("feedback", $data);
return $this->db->insert_id();
}
I think you use
$this->load->library('database');
Instead
$this->load->database();
Change setting on config folder in autoload.php
$autoload['libraries'] = array('database','form_validation', 'session');
$autoload['helper'] = array('url','form');
Got the Error myself.
I had forgot to add 'method="post"' to my form.

codeigniter form validation not displaying errors

I am using a wamp server on my local machine , to host my codeigniter project.
Everything seems to work well , but the form validation wont display the errors when one occur.
The callback to check if email already exist doesnt also work , which is really weird because it was working last night.
this is my controller -
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Signup extends MX_Controller
{
function __construct() {
parent::__construct();
//calling helpers and library classes from ci
$this->load->helper(array('form', 'url'));
$this->load->helper('date');
$this->load->library('form_validation');
}
public function index() {
// loading the registration form
$this->load->view('register');
// form validation
$this->form_validation->set_rules('username', 'Username', 'required|min_length[3]|max_length[12]|is_unique[gamers.username]');
$this->form_validation->set_rules('email','Email','trim|required|valid_email|callback_isEmailExist');
$this->form_validation->set_rules('country', 'Country', 'required');
$this->form_validation->set_rules('region', 'Region', 'required');
$this->form_validation->set_rules('dob', 'Birth Date', 'required');
$this->form_validation->set_rules('phone', 'Mobile Number', 'required');
$this->form_validation->set_rules('passphrase', 'Password', 'trim|required|sha1');
$this->form_validation->set_rules('referral', 'Referred By');
if ($this->form_validation->run() !== FALSE)
{
//loading model
$this->load->model('signup_model');
// preparing form data
$username = $this->input->post('username');
$email = $this->input->post('email');
$country = $this->input->post('country');
$region = $this->input->post('region');
$dob = $this->input->post('dob');
$phone = $this->input->post('phone');
$password = $this->input->post('passphrase');
$referred = $this->input->post('referral');
//check current time stamp
$join_date = date('Y-m-d H:i:s');
//email verification hush key-generator
$token = md5(rand(0,1000).'cashout233');
// packaging form data for transport in an array
$data = array(
'username' => $username,
'email' => $email,
'country' => $country,
'region' => $region,
'birthdate' => $dob,
'phone_number' => $phone,
'password' => $password,
'join_date' => $join_date,
'referral' => $referred,
'token' => $token
);
// finally transporting data to the model
$taxi = $this->signup_model->register_gamer($data);
if ($taxi !== false) {
// send email verification link after sucessfull transport
// $from = 'noreply#talenthut.com';
// $to = $email;
// $subject = 'Email Confirmation Instructions';
// $message = '
// '.$first_name.', Thanks for signing up!
// Please click this link to activate your account:
// localhost/index.php/email_verification?email='.$email.'&hash='.$hash.'
// '; // Our message above including the link
// $this->email->from($from);
// $this->email->to($email);
// $this->email->subject($subject);
// $this->email->message($message);
// $this->email->send();
// Redirect user to Email Confirmation Page
redirect('index.php/signup/EmailConfirmation/'.urlencode($email));
}
}
}
public function isEmailExist($str) {
$this->load->model('signup_model');
$is_exist = $this->signup_model->isEmailExist($str);
if ($is_exist) {
$this->form_validation->set_message(
'isEmailExist', 'Email address is already in use.'
);
return false;
} else {
return true;
}
}
public function EmailConfirmation($to)
{
echo "email has been sent to ".urldecode($to);
// loading the email confirmation page
// $this->load->view('e_confirmation');
}
}
My view that displays the registration form is -
<?php echo form_open('index.php/signup'); ?>
<!-- fieldsets -->
<fieldset>
<div class="errors"> <?php echo validation_errors(); ?> </div>
<label>
<input id="username" type="text" name="username" value="" placeholder="Username" />
</label>
<label>
<input id="email" type="email" name="email" value="" placeholder="Email" />
</label>
<label>
<select name="country"><br/>
<option value="Ghana">Ghana</option>
</select>
</label>
<label>
<select name="region"><br/>
<option value="">Choose Region...</option>
<option value="Greater Accra">Greater Accra</option>
<option value="Central">Central</option>
<option value="Western">Western</option>
<option value="Eastern">Eastern</option>
<option value="Ashanti">Ashanti</option>
<option value="Brong Ahaful">Brong Ahaful</option>
<option value="Northen">Northen</option>
<option value="Volta">Volta</option>
<option value="Upper East">Upper East</option>
<option value="Upper West">Upper West</option>
</select>
</label>
<label>
<input id="dob" type="text" name="dob" value="" placeholder="Birth Date" />
</label>
<label>
<input id="phone" type="text" name="phone" value="" placeholder="Mobile Number" />
</label>
<label>
<input id="password" type="password" name="passphrase" value="" placeholder="Password" />
</label>
<label>
<select name="referral"><br/>
<option value="">how did you know about us</option>
<option value="Search Engine">Search engine</option>
<option value="Twitter">Twitter</option>
<option value="Word of Mouth">Word of mouth</option>
<option value="Newspaper">Newspaper</option>
</select>
</label>
<label>
<span> </span>
<p class="help">By clicking the sign up button below, you confirm that you are 18 years , and you agree to our
Terms and Conditions and Privacy Policy.</p><br/><br/>
<span> </span>
<button class="submit" type="submit">Sigm Up</button>
</label>
</fieldset>
</form>
model function for the isEmailExist controller function is
function isEmailExist($email) {
$this->db->select('id');
$this->db->where('email', $email);
$query = $this->db->get('gamer');
if ($query->num_rows() > 0) {
return true;
} else {
return false;
}
}
Thanks in advance.
worked it out!!!
I realised the validations doesnt work with redirections but only views.
I also called the login form too early before the validation. I placed it in the if condition and everything worked like a charm .
As for the "callback " . I just had to eliminate all that nonsense and replaced it with is_unique.
You can check email exist or Not as simply applying codeigniter inbuild rule:
is_unique[table_name.table_coloum]
$this->form_validation->set_rules('email', 'Email', 'required|trim|xss_clean|is_unique[users.email]');

Codelgniter Form Validation Showed double repeated form after validate

Tried to read though all the webpages and docs in google and stack flow but still could not solve the problem.
I tried to do a simple data validation for registration form and it turns out showing another form below the original one after I press submit to show the error messages with a new form.
I am a newbie in this language so please let me know if I attache not enough codes or information.
Controller account:
<?php
class Account extends MY_Controller {
public function __construct() {
parent::__construct();
session_start();
$this->load->model('user');
$this->load->helper(array('form','url','html'));
$this->load->library('session');
$this->load->library('form_validation');
}
public function registration() {
$data = $this->user->users_info();
$this->load->view('account/registration',$data);
$this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[20]');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password ', 'required|matches[passconf]|min_length[5]');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
if($this->input->post('submit')) {
$username= $this->input->post('username');
$email= $this->input->post('email');
$query_u= $this->user->retrieve_by_username($username);
$query_e= $this->user->retrieve_by_email($email);
if ($this->form_validation->run() == FALSE){
$this->load->view('account/registration',$data); ←---------------- (I think this is wrong, it makes load the second form out.)
}
else{
if(!empty($query_u) or !empty($query_e)) {
redirect('account/registrat');
}
else {
$data = array(
'username'=>$this->input->post('username'),
'email'=>$this->input->post('email'),
'password'=>$this->input->post('password'),
'is_admin'=>0,
);
$this->user->create_user($data);
redirect('/account/login');
}
}
}
}
View Registration.php
<center>
<?php echo form_open_multipart('account/registration'); ?>
<h5><?php echo $b_username;?> (Minimum 5 characters)</h5>
<input type="text" name="username" id="username" value="<?php echo set_value('username'); ?>" size="50" /><?php echo form_error('username'); ?>
<h5><?php echo $b_email;?></h5>
<input type="text" name="email" value="<?php echo set_value('email'); ?>" size="50" />
<?php echo form_error('email'); ?>
<h5><?php echo $b_password;?> (Minimum 5 characters)</h5>
<input type="text" name="password" value="<?php echo set_value('password'); ?>" size="50" />
<?php echo form_error('password'); ?>
<h5><?php echo $b_passconf;?></h5>
<input type="text" name="passconf" value="" size="50" />
<?php echo form_error('passconf'); ?>
<h5></h5>
<div><?php echo form_submit('submit', 'Submit') ?></div>
</center>
Model user.php
<?php
class User extends CI_Model {
function __construct() {
parent::__construct();
$this->load->database();
}
function users_info() {
$data['b_id'] = 'id';
$data['b_username'] = 'Username';
$data['b_email'] = 'Email';
$data['b_password'] = 'Password';
$data['b_passconf'] = 'Enter Password Again';
$data['b_is_admin'] = 'Is_admin';
$data['b_default_privacy'] = 'Default_privacy';
$data['b_first_name'] = 'First_Name';
$data['b_last_name'] = 'Last_Name';
$data['b_gender'] = 'Gender';
$data['b_birthday'] = 'Birthday';
$data['b_friend_id'] = 'Friend_id';
$data['b_weight'] = 'Weight';
$data['b_height'] = 'Height';
$data['b_daily_cal_intake'] = 'Daily_calorie_intake';
$data['b_target_weight'] = 'Target_weight';
$data['b_regional_id'] = 'Region';
$data['b_profile_pic'] = 'Profile Picture';
return $data;
}
function retrieve_by_username($username) {
$query = $this->db->get_where('001_users',array('username'=>$username));
return $query->row_array();
}
function retrieve_by_email($email) {
$query = $this->db->get_where('001_users', array('email'=>$email));
return $query->row_array();
}
Change your function to this and try..
public function registration()
{
$this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[20]');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password ', 'required|matches[passconf]|min_length[5]');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
if ($this->form_validation->run() == false) // if validation fails for first time and every time when ever condtion is not satisified
{
$data = $this->user->users_info();
$this->load->view('account/registration',$data);
}
else
{
$username= $this->input->post('username');
$email= $this->input->post('email');
$query_u= $this->user->retrieve_by_username($username);
$query_e= $this->user->retrieve_by_email($email);
if(!empty($query_u) or !empty($query_e)) {
redirect('account/registrat');
}
else {
$data = array(
'username'=>$this->input->post('username'),
'email'=>$this->input->post('email'),
'password'=>$this->input->post('password'),
'is_admin'=>0
);
$this->user->create_user($data);
// send sucess msg here
redirect('/account/login');
}
}
}

how to set RememberMe CodeIgniter Spark

I am trying to set the joeauty / RememberMe-CodeIgniter-Spark. I added the rememberme.php inside the config forler, the Rememberme.php inside system/libraries/ made the changes inside autoload.php and config.php and created 2 tables( ci_cookies and ci_sessions) into the database.
If don't click the checkbox I can login, but if I select the checkbox nothing happens.
This is my controller:
function __construct()
{
parent::__construct();
$this->load->model('registerclient_model','',TRUE);
}
function index()
{
if($this->session->userdata('logged_in') || $this->session->userdata('user_id'))
{ redirect('client_private_area', 'refresh');}
else{
$this->load->library('form_validation');
$this->form_validation->set_rules('email_address', 'Email', 'trim|required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback_check_database');
if($this->form_validation->run() == FALSE)
{
$data['error'] = 'Invalid email address and/or password.';
$this->load->view('templates/header');
$this->load->view('pages/login/client_login', $data);
$this->load->view('templates/footer');
}
else
{
//Go to private area
redirect('client_private_area', 'refresh');
}
}
}
function check_database($password)
{
$email = $this->input->post('email_address');
$result = $this->registerclient_model->login($email, $password);
if($result){
if($this->input->post('netid') == "on"){
$this->rememberme->setCookie($this->input->post('netid'));
if ($this->rememberme->verifyCookie()) {
// find user id of cookie_user stored in application database
$user = User::findUser($cookie_user);
// set session if necessary
if (!$this->session->userdata('user_id')) {
$this->session->set_userdata('user_id', $user);
}
$this->user = $user;
}
else if ($this->session->userdata('user_id')) {
$this->user = $this->session->userdata('user_id');
}
}
else
{
$sess_array = array();
foreach($result as $row)
{
$sess_array = array(
'id' => $row->id,
'first_name' => $row->first_name,
'email_address' => $row->email_address
);
$this->session->set_userdata('logged_in', $sess_array);
}
return TRUE;
}
}
else
{
$this->form_validation->set_message('check_database', 'Invalid email address and/or password.');
return false;
}
}
this is my model:
function login($email, $password) {
//create query to connect user login database
$this->db->select('id, first_name, email_address, password');
$this->db->from('client_register');
$this->db->where('email_address', $email);
$this->db->where('password', $this->registerclient_model->hash($password));
$this->db->limit(1);
//get query and processing
$query = $this->db->get();
if($query->num_rows() == 1)
{
return $query->result(); //if data is true
}
else
{
return false; //if data is wrong
}
}
this is my view:
<div class="client_login_content_form">
<h1>CLIENT LOGIN FORM</h1>
<p class="loginform_error"><?php echo validation_errors(''); ?></p>
<?php echo form_open('verifylogin'); ?>
<ul>
<li><input type="text" size="20" id="email" name="email_address" value="<?php echo set_value('email_address'); ?>" required placeholder="Email Address"/></li>
<li><input type="password" size="20" id="passowrd" name="password" value="<?php echo set_value('password'); ?>" required placeholder="Password"/></li>
<li><p><input type="checkbox" name="netid" id="netid" checked>Remember me</p></li>
<li><input type="submit" class="login_content_form_button" value="LOG IN"/></li>
</ul>
<p class="forgot_login">Forgot your password?</p>
</form>
</div>
<form action="<?php echo site_url('admin'); ?>"><input type="submit" value="Admin" class="admin_button" /></form>

Categories