[eluser]Unknown[/eluser]
Hi!
I'm having problems validating a form... And I don't know why. I don't get any value from set_values() and even if I remove all the rules I still get FALSE when I'm trying to validate it...
Here is the form:
Code:
<?php echo validation_errors(); ?>
<?php echo form_open('contact'); ?>
<table>
<tr valign="top">
<td>
<fieldset id="perso">
<legend>Informations Personelles</legend>
<label for="txtNom">Votre nom:</label><input type="text" id="txtNom" value="<?=set_value('txtNom'); ?>" />
<label for="txtCourriel">Votre adresse courriel:</label><input type="text" id="txtCourriel" value="<?=set_value('txtCourriel'); ?>" /><br /><br />
<p align="center"><input type="submit" value="Envoyer" id="button" /></p>
</fieldset>
</td>
<td>
<fieldset id="message">
<legend>Votre message</legend>
<textarea id="txtMessage"><?=set_value('txtMessage'); ?></textarea>
</fieldset>
</td>
</tr>
</table>
</form>
and here is the controlleR:
Code:
<?php
class Contact extends Controller {
function index()
{
$helpers = array('html', 'url', 'text', 'form');
$this->load->helper($helpers);
$data['infos'] = $this->db->get('contact');
$this->load->library('form_validation');
$this->form_validation->set_rules('txtNom', 'Votre nom', 'required');
$this->form_validation->set_rules('txtCourriel', 'Votre adresse courriel', 'required|valid_email');
$this->form_validation->set_rules('txtMessage', 'Votre message', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('contactview', $data);
}
else
{
$this->load->view('contact_successview', $data);
}
}
}
?>
contactview is actually the form's view.
Thanks a lot!