09-17-2008, 12:48 AM
[eluser]dimis[/eluser]
I have this function for validation of a form
But the code
does not work. I have some text inputs with name name_gr, name_en,name_it etc that have last 2 letters from database.
HOw can I fix it and validtaete thiw inputs
I have this function for validation of a form
Code:
function myvalidproduct()
{
// $lancode=array();
$lancode=$this->lans->returnonlycode();
$this->load->library('validation');
$fields['code']= "code";
// $fields['active']= "active";
// $fields['material']= "material";
foreach ($lancode as $lan)
{
$el="name_".$lan['lan_code'];
$fields[$el]= "$el";
$rules[$el]= "required";
}
$rules['code'] = "required";
// $rules['active'] = "active";
// $rules['material'] = "material";
$this->validation->set_fields($fields);
$this->validation->set_rules($rules);
}
... $this-> myvalidproduct();
But the code
Code:
foreach ($lancode as $lan)
{
$el="name_".$lan['lan_code'];
$fields[$el]= "$el";
$rules[$el]= "required";
}
HOw can I fix it and validtaete thiw inputs