Welcome Guest, Not a member yet? Register   Sign In
problem with form and validation
#1

Hello.
I am using CI4. I have a form with a dropdown and I can't get validation to work.

I tried putting a required in the dropdown itself and it didn't work either. The code goes below.

PHP Code:
$val=$this->validate([
                        'fk_orcamento'=>'is_natural',
                        'fk_orc_prod'=>'is_natural',
                        ]        
                    
);
                    //Se não passar na validação retorna para a página anterio (back) com os erros.
                    if(!$val){
                        helper('[old]');
                        return redirect()->back()->withInput()->with('errors'$validation->getErrors());
                    }
                    $dados=[
                        'fk_orcamento'=>$post['fk_orcamento'],
                        'fk_orc_prod'=>$post['produto'],
                    ]; 

PHP Code:
<?php echo form_dropdown('produto',$dropProdutos,'null',['class'=>'form-control']) ?>
Reply


Messages In This Thread
problem with form and validation - by clovissardinha - 01-19-2024, 02:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB