[eluser]ToXXXic[/eluser]
Hi,
I am using the CI form tutorial but for some reason the validation_errors() is not echoing anything. I am using PHP 5.3 do you guys think that could be the reason? The validation check works fine it is just that no error is displayed when the fileds are emty.
Controller:
Code:
<?php
class Form extends Controller {
function Form(){
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
$this->load->library('form_validation');
}
function index()
{
//$this->load->helper(array('form', 'url'));
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>
View file
Code:
<html>
<head>
<title>My Form</title>
</head>
<body>
<?php //echo validation_errors();?>
<?php echo validation_errors('<p>Testing','</p>'); ?>
<?php echo form_open('form'); ?>
<h5>Username</h5>
<input type="text" name="username" value="" size="50" />
<h5>Password</h5>
<input type="text" name="password" value="" size="50" />
<h5>Password Confirm</h5>
<input type="text" name="passconf" value="" size="50" />
<h5>Email Address</h5>
<input type="text" name="email" value="" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
success pageCode:
<html>
<head>
<title>My Form</title>
</head>
<body>
<h3>Your form was successfully submitted!</h3>
<p><?php echo anchor('form', 'Try it again!'); ?></p>
</body>
</html>
Thanks in advance