CodeIgniter Forums
"Little" question on form_validation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: "Little" question on form_validation (/showthread.php?tid=13405)



"Little" question on form_validation - El Forum - 11-21-2008

[eluser]hugle[/eluser]
Hello.

I currently whore a little extention to form_validation
I called it : if_exists
example below:
Code:
$this->form_validation->set_rules('iam', 'I am', 'if_exists[iam.id]');
I wonder if I can pass variable from $_POST request into this extention?

for example I would like to pass the value of $_POST['country'] to the:
Code:
$this->form_validation->set_rules('iam', 'I am', 'if_exists[iam.id]');
I found this one working:
Code:
$country = $_POST['country'];
$this->form_validation->set_rules('iam', 'I am', "if_exists[iam.id.$country]");
Maybe there is more clever way to do this ?

Using some "native" functions of form validator or something similar?

Thank you !