• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
form_validation and URI segment variable


I'm new to CodeIgnter and can't find any answers to this in the forum (I found one user with the same issue but the solution didn't match mine), so I'm assuming I'm taking the wrong approach.


I have successfully used the form_validation class for my login. I liked it; so I want to keep using it.

I have a system where you edit a user, the URI being:


It's a simple pre-populated form using values from the DB, with the '123' being the user id.

The Problem

The form_validation tutorial in the CI user guide features a simple login form that loads the same view (passing no URI segment variable).

So when the form tries to validate it loads the 'users/edit' view without the user_id URI which throws all sorts of errors, as you can imagine. (It does not have the user_id to populate the form)

What I have tried

Well, I added some bletcherous code that detects the user_id from the post variables, should there not be the URI segment. This works, but does not load my form_error() strings. So, actually it doesn't really work.

In summary, from what I can fathom, either:

1) I'm doing it all wrong - my approach is fundamentally flawed
2) There's something simple I have missed and I will be really embarrassed
3) The form_validation class is but a simple class, and only used for basic input forms.
4) I am rubbish and haven't grasped the CI URI concept

Many thanks in advance,


Messages In This Thread
form_validation and URI segment variable - by El Forum - 08-01-2011, 06:16 AM
form_validation and URI segment variable - by El Forum - 08-01-2011, 06:21 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.