• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hidden field not been submitted with form validation

(12-28-2015, 12:50 AM)Diederik Wrote: Ah yes, sorry I didn't spot that error in my first response. You need to tell the validation library which rules needs to be applied for each POST variable. You should always make your validation rules as strict as possible. In your case you expect a value of 1 and nothing else.

$this->form_validation->set_rules('down_vote', 'Down Vote', 'trim|required|integer');

This way the form is only validated when a integer is posted and not some SQL injection hacker string for example. Not that it matters in your particular codeset because you don't use the posted value itself but it's good practice to make sure all the posted fields contain data of a type that you expect it should be before you can (safely) use that data.

Here is a list with all the build in validation rules:

But you can also write your own validation rules to meet your needs.

That is really good to know thanks. I am having a go at making my own forum even though there are some all ready out there just good practice. With bootstrap etc and moderator & user groups etc
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!

Messages In This Thread
RE: Hidden field not been submitted with form validation - by wolfgang1983 - 12-28-2015, 12:59 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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