jeudi 22 novembre 2018

inserting and selecting multiple values of checkbox in mssql stored procedure

here is where I get the values of the checkboxes. It is working. `

                    echo "<div class='table-responsive' >";
                          echo "<table class='table table bordered' style='font-size: 14px'>";
                          echo "<th style = ''> Action</th>"; 
                          echo "<th style = ''>Document</th>"; 
                    echo "</div>";

                        $cntr = 1;

                while ($row = sqlsrv_fetch_array($loadDocs)) 
                        {
                        echo "<tr>"; 

                        echo "<td  style = 'text-align:center;width:10%'>
                        <input type='checkbox' id='NAMING".$cntr."' value='".$row['DocCode']."' /></td>";
                        echo"<td  style = 'width:10%''>".$row["DocDesc"]."</td>";

                        echo "</tr>"; 
                        $cntr++;
                      }
                      ?>`

Help this is my php code for the selection and insertion of checkbox values in mssql stored procedure. I cant figure out what is wrong with the code. Please help.

`<?php

 if(isset($_POST['BTN_Proceed']))
 {
      $x=1;
      $BankName = $_POST['BankName'];
      $BankCode = $_POST['BankCode'];
      $DocCode  = $_POST['DocCode'];
      $rowCount = $_SESSION["rowCount"];

      while ($x < $rowCount)
          {
                    $insertDocsParam = array(array($BankName,SQLSRV_PARAM_IN),
                                                array($BankCode,SQLSRV_PARAM_IN),
                                                array($Doccode,SQLSRV_PARAM_IN),
                                                array($_POST["NAMING".$x],SQLSRV_PARAM_IN),);

                    $insertDocs = sqlsrv_query($conn, '{CALL sp_SRP_Insert_Doc (?,?,?,?)}', $insertDocsParam) or 
                    die( print_r( sqlsrv_errors(), true));;
                    $x++;
          }
      }   
?>`




Aucun commentaire:

Enregistrer un commentaire