[eluser]Unknown[/eluser]
Hi all
I've tried to debug a strange behaviour for the last 5 hours and I guess I need some help now
It must be something completely obvious but I just cannot see it...
I have one controller which returns FALSE upon $this->form_validation->run().
However, it returns an empty validation_errors string and hence no error message.
- I have another controller that is working perfectly
- If I supply correct values, the form is submitted successfully.
so this is my view:
Code:
<html>
<head>
<title>Register</title>
</head>
<body>
<h1>Register</h1>
<?php echo validation_errors(); ?>
<?php echo form_open('registration'); ?>
<h5>Username*</h5>
<input type="text" name="username" value="<?php echo set_value('username'); ?>" size="50" />
<h5>Password*</h5>
<input type="password" name="password" value="<?php echo set_value('password'); ?>" size="50"/>
<h5>Confirm Password*</h5>
<input type="password" name="passconf" value="<?php echo set_value('passconf'); ?>" size="50" type ="password"/>
<h5>Email*</h5>
<input type="text" name="email" value="<?php echo set_value('email'); ?>" size="50" value=""/>
<h5>Re-type Email*</h5>
<input type="text" name="emailconf" value="<?php echo set_value('emailconf'); ?>" size="50" value=""/>
<h5>First Name</h5>
<input type="text" name="fname" value="<?php echo set_value('fname'); ?>" size="50" value=""/>
<h5>Last Name</h5>
<input type="text" name="lname" value="<?php echo set_value('lname'); ?>" size="50" value=""/>
<h5>Company Name</h5>
<input type="text" name="cname" value="<?php echo set_value('cname'); ?>" size="50" value=""/>
<!-- button -->
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
And this is my controller (I have only one validation rule left for debugging...):
Code:
<?php
class Registration extends CI_Controller
{
public function __construct()
{
parent::__construct();
// make sure user is really not logged in
$acc_id = $this->session->userdata('account_id');
if ( ! empty($acc_id) ) { redirect( 'mypage', 'refresh'); }
}
function index()
{
$this->load->helper(array('form'));
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('registration_1_vw');
}
else
{
[... removed, because this is working ...]
}
}