[eluser]blavaciko[/eluser]
I'm trying to get my forms working.
But i cannot run the validation on them.
I was using the user guide step by step, but it's not working, returning me empty form again.
I tried to echo username field value, but nothing happend
can anybody help me?
Controller
Code:
<?php
class Form extends Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->view('myform');
}
function send()
{
$username = $this->input->post('username');
echo $username;
$this->load->helper(array('form', 'url'));
$this->form_validation->set_rules('username', 'Username', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>
View
Code:
<html>
<head>
<title>My Form</title>
</head>
<body>
<?php echo validation_errors(); ?>
<?php echo form_open('form/send'); ?>
<h5>Username</h5>
<input type="text" name="username" value="" id="username" 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>