lundi 3 juillet 2017

Passing checkbox value from view to controller in laravel

How to pass checkbox value from views to controller so that I can compare the checked/unchecked values? (for database updation)

Views:

             @foreach ($second as $sec)
                            <br>
                          <div class = "form-group">

                            
                            &nbsp&nbsp&nbsp&nbsp
                            
                            </div>
                            <div class = "form-group">
                            <input tabindex="1" type="checkbox" value=""  name="1"  />
                            </div>
             @endforeach

Controller:

 foreach ($columns as $col)
            {
                    //dd("Y");
                    if($col == $txt[1])
                    {
                            $got=DB::table($req)->select($col)->get();
                            //dd($got);
  //COMPARE CHECKBOX VALUE "CHECKED/UNCHECKED" WITH ITS DEFAULT VALUE 
                            DB::statement("UPDATE " . $req . " set " . $got . " to " . $got . " + 1 WHERE" .$req->Roll . " IN ".( implode(',', $req)));

                    }
            }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire