Articles → PHP CODEIGNITER → validation_errors and form_error in codeigniter

validation_errors and form_error in codeigniter






Purpose







Example




$this->load->helper('form'); 
$this->load->library('form_validation'); 
$this->form_validation->set rules('username', 'Username', 'required'); 
$this->form_validation->set rules('name', 'Name', 'required'); 
$this->form_validation->run();
$this->load->view('users');




<?php 
echo validation_errors(); 
echo form_open(); 
echo form_input('username', "); 
echo form_error('username',''); 
echo form_input('name', ''); 
echo form_submit('mysubmit', 'Click Me'); 
echo form close();?> 





Output




Picture showing the web page when loaded for first time

Click to Enlarge



Picture showing the output of form_error and validation_errors in codeigniter

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, August 6, 2020

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250