inserting and selecting multiple values of checkbox in mssql stored procedure












0















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++;
}
}
?>`


This is my Stored Procedure for the insert query what else do I need to add here? Because Im also getting the checkbox data from sql server.



`ALTER PROCEDURE [dbo].[sp_SRP_Insert_Doc] 
(@BankName nvarchar(50),@BankCode nvarchar(5),@DocCode nvarchar(5))

AS
BEGIN
SET NOCOUNT ON;
BEGIN
INSERT INTO [dbo].[ZREF_ROUT_INCO_DOC]
(BankName,BankCode,DocCode)

VALUES
(@BankName,@BankCode,@DocCode)
END

END`









share|improve this question




















  • 2





    What exactly is or isn't working?

    – Dale Burrell
    Nov 23 '18 at 2:38











  • When I select a checkbox then clicked the proceed button, theres no respond in the BTN_Proceed. I cannot add data in sp_SRP_Insert_Doc. I want to display the value of the checkbox="checked" in the database.

    – Joseph Escosura
    Nov 23 '18 at 2:41











  • Have you tested the SP standalone from SSMS?

    – Dale Burrell
    Nov 23 '18 at 2:42











  • Yes. I will attach the SP in my post.

    – Joseph Escosura
    Nov 23 '18 at 2:45











  • I don't know PHP but based on this (you can google for more) are you 100% sure you are using the correct syntax to call SQL Server? stackoverflow.com/questions/31575135/…

    – Dale Burrell
    Nov 23 '18 at 2:54
















0















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++;
}
}
?>`


This is my Stored Procedure for the insert query what else do I need to add here? Because Im also getting the checkbox data from sql server.



`ALTER PROCEDURE [dbo].[sp_SRP_Insert_Doc] 
(@BankName nvarchar(50),@BankCode nvarchar(5),@DocCode nvarchar(5))

AS
BEGIN
SET NOCOUNT ON;
BEGIN
INSERT INTO [dbo].[ZREF_ROUT_INCO_DOC]
(BankName,BankCode,DocCode)

VALUES
(@BankName,@BankCode,@DocCode)
END

END`









share|improve this question




















  • 2





    What exactly is or isn't working?

    – Dale Burrell
    Nov 23 '18 at 2:38











  • When I select a checkbox then clicked the proceed button, theres no respond in the BTN_Proceed. I cannot add data in sp_SRP_Insert_Doc. I want to display the value of the checkbox="checked" in the database.

    – Joseph Escosura
    Nov 23 '18 at 2:41











  • Have you tested the SP standalone from SSMS?

    – Dale Burrell
    Nov 23 '18 at 2:42











  • Yes. I will attach the SP in my post.

    – Joseph Escosura
    Nov 23 '18 at 2:45











  • I don't know PHP but based on this (you can google for more) are you 100% sure you are using the correct syntax to call SQL Server? stackoverflow.com/questions/31575135/…

    – Dale Burrell
    Nov 23 '18 at 2:54














0












0








0








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++;
}
}
?>`


This is my Stored Procedure for the insert query what else do I need to add here? Because Im also getting the checkbox data from sql server.



`ALTER PROCEDURE [dbo].[sp_SRP_Insert_Doc] 
(@BankName nvarchar(50),@BankCode nvarchar(5),@DocCode nvarchar(5))

AS
BEGIN
SET NOCOUNT ON;
BEGIN
INSERT INTO [dbo].[ZREF_ROUT_INCO_DOC]
(BankName,BankCode,DocCode)

VALUES
(@BankName,@BankCode,@DocCode)
END

END`









share|improve this question
















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++;
}
}
?>`


This is my Stored Procedure for the insert query what else do I need to add here? Because Im also getting the checkbox data from sql server.



`ALTER PROCEDURE [dbo].[sp_SRP_Insert_Doc] 
(@BankName nvarchar(50),@BankCode nvarchar(5),@DocCode nvarchar(5))

AS
BEGIN
SET NOCOUNT ON;
BEGIN
INSERT INTO [dbo].[ZREF_ROUT_INCO_DOC]
(BankName,BankCode,DocCode)

VALUES
(@BankName,@BankCode,@DocCode)
END

END`






php sql-server stored-procedures checkbox






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 2:57







Joseph Escosura

















asked Nov 23 '18 at 2:36









Joseph EscosuraJoseph Escosura

11




11








  • 2





    What exactly is or isn't working?

    – Dale Burrell
    Nov 23 '18 at 2:38











  • When I select a checkbox then clicked the proceed button, theres no respond in the BTN_Proceed. I cannot add data in sp_SRP_Insert_Doc. I want to display the value of the checkbox="checked" in the database.

    – Joseph Escosura
    Nov 23 '18 at 2:41











  • Have you tested the SP standalone from SSMS?

    – Dale Burrell
    Nov 23 '18 at 2:42











  • Yes. I will attach the SP in my post.

    – Joseph Escosura
    Nov 23 '18 at 2:45











  • I don't know PHP but based on this (you can google for more) are you 100% sure you are using the correct syntax to call SQL Server? stackoverflow.com/questions/31575135/…

    – Dale Burrell
    Nov 23 '18 at 2:54














  • 2





    What exactly is or isn't working?

    – Dale Burrell
    Nov 23 '18 at 2:38











  • When I select a checkbox then clicked the proceed button, theres no respond in the BTN_Proceed. I cannot add data in sp_SRP_Insert_Doc. I want to display the value of the checkbox="checked" in the database.

    – Joseph Escosura
    Nov 23 '18 at 2:41











  • Have you tested the SP standalone from SSMS?

    – Dale Burrell
    Nov 23 '18 at 2:42











  • Yes. I will attach the SP in my post.

    – Joseph Escosura
    Nov 23 '18 at 2:45











  • I don't know PHP but based on this (you can google for more) are you 100% sure you are using the correct syntax to call SQL Server? stackoverflow.com/questions/31575135/…

    – Dale Burrell
    Nov 23 '18 at 2:54








2




2





What exactly is or isn't working?

– Dale Burrell
Nov 23 '18 at 2:38





What exactly is or isn't working?

– Dale Burrell
Nov 23 '18 at 2:38













When I select a checkbox then clicked the proceed button, theres no respond in the BTN_Proceed. I cannot add data in sp_SRP_Insert_Doc. I want to display the value of the checkbox="checked" in the database.

– Joseph Escosura
Nov 23 '18 at 2:41





When I select a checkbox then clicked the proceed button, theres no respond in the BTN_Proceed. I cannot add data in sp_SRP_Insert_Doc. I want to display the value of the checkbox="checked" in the database.

– Joseph Escosura
Nov 23 '18 at 2:41













Have you tested the SP standalone from SSMS?

– Dale Burrell
Nov 23 '18 at 2:42





Have you tested the SP standalone from SSMS?

– Dale Burrell
Nov 23 '18 at 2:42













Yes. I will attach the SP in my post.

– Joseph Escosura
Nov 23 '18 at 2:45





Yes. I will attach the SP in my post.

– Joseph Escosura
Nov 23 '18 at 2:45













I don't know PHP but based on this (you can google for more) are you 100% sure you are using the correct syntax to call SQL Server? stackoverflow.com/questions/31575135/…

– Dale Burrell
Nov 23 '18 at 2:54





I don't know PHP but based on this (you can google for more) are you 100% sure you are using the correct syntax to call SQL Server? stackoverflow.com/questions/31575135/…

– Dale Burrell
Nov 23 '18 at 2:54












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440025%2finserting-and-selecting-multiple-values-of-checkbox-in-mssql-stored-procedure%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440025%2finserting-and-selecting-multiple-values-of-checkbox-in-mssql-stored-procedure%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Paul Cézanne

UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

Angular material date-picker (MatDatepicker) auto completes the date on focus out