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

#5
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.

Code:
$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:
https://www.codeigniter.com/userguide3/l...-reference

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


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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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