Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter FormValidator Example doesn't work out of the box
#1

[eluser]futo[/eluser]
Yes, me 2 Smile ..

I'm two weeks new to CI - but not new to a computer. Normally I'm the guy helping other people.

Have tested some code in nginx and now migrated to apache, where I'm starting to implement some forms and there validation. Some form validation code didn't work, and I jumped to the school example from CI to see if that worked: It didn't. I've used two days researching on the en-us part of the internet, and still no solution.

form_validation->run() always fails ...
Trying the form example from the official CI pages where form_validation->run() always fails.
- My base URL in config.php is set with an trailing slash.

The code is the same as on the pages of CI: http://ellislab.com/codeigniter/user-gui...ation.html . I've just implemented the first part inclusive 'Setting Validation Rules'. But with no success (I can't reach formsucces.php).

I've added this snippet to the code of CI - and it does always return '$_POST is NOT set!'.

Code:
if(isset($_POST['submit'])){
   echo '$_POST is set! <br>';
  } else {
   echo '$_POST is NOT set! <br>';
  }


The code from CI with the above implemented:

Code:
&lt;?php
class Form extends CI_Controller {

function index()
{
  $this->load->helper(array('form', 'url'));

  $this->load->library('form_validation');

  if(isset($_POST['submit'])){
   echo '$_POST is set! <br>';
  } else {
   echo '$_POST is NOT set! <br>';
  }
  
  $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');
  }
}
}
?&gt;

Any ideas?...


Messages In This Thread
CodeIgniter FormValidator Example doesn't work out of the box - by El Forum - 03-22-2013, 10:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB