COdigo checkbox
este es mi metodo post
$valueCustomer ='';//departamento de salida
$valueLoc='lOC_CODE';
$valueLot='LOT_CODE';
$ValueOPT ='';
$ValueOPT1 ='OPT1';
$ValueOPT3 ='OPT2';
$ValueOPT2 ='OPT3';
$seleccionados='';
for($i=0; $i <=count($_POST); $i++){
if (isset($_POST['checkbox1'])) {
$seleccionados=$_POST['checkbox1'];
}
}
for($i=0; $i <=count($_POST); $i++){
if (isset($_POST['checkbox2'])) {
$seleccionados=$_POST['checkbox2'];
}
}
for($i=0; $i <=count($_POST); $i++){
if (isset($_POST['checkbox3'])) {
$seleccionados=$_POST['checkbox3'];
}
}
este es mi codigo de mi procedimiento almacenado
<? php
$valueInqPart='';
for($i=0;$i<=count($_POST); $i++){
if (isset($_POST["check_".$i.""])) {
$valueInqPart= $_POST["check_".$i.""];
$valueInqPart = strtoupper($valueInqPart);
if (isset($_POST['operation']) && $_POST['operation'] == 'OK' ) {
}
$p1 = 'TPH';
$p2 = 'MG';
$p3 = $valueCustomer; //Departamento de salida de material
$p4 = $seleccionados; // Departamento de entrada
$p5 = $valueLoc; //$valueLoc; //lOC_CODE
$p6 = $valueInqPart;//$valueInqPart;//Numero de parte
$p7 = $valueLot;//$valueLot;//LOT_CODE
$p8 = 1;//Cantiad de salida
$p9 = '2198';//Usurio ingresado en el sistema para el registratr poner el del login
$stid = oci_parse($conn,'begin SP_WEB_PRODUCTION_MOVE_WIP(:p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11); end;');
oci_bind_by_name($stid, ':p1', $p1);
oci_bind_by_name($stid, ':p2', $p2);
oci_bind_by_name($stid, ':p3', $p3);
oci_bind_by_name($stid, ':p4', $p4);
oci_bind_by_name($stid, ':p5', $p5);
oci_bind_by_name($stid, ':p6', $p6);
oci_bind_by_name($stid, ':p7', $p7);
oci_bind_by_name($stid, ':p8', $p8);
oci_bind_by_name($stid, ':p9', $p9);
oci_bind_by_name($stid, ':p10',$out1, 40);
oci_bind_by_name($stid, ':p11',$out2, 40);
oci_execute($stid);
//Aqui se valida los valores de retorno
//if ($out1 == "SUCCESS") {
// header('Location:sucess.php');
//} else {
// header('Location:failure.php');
//}
echo "</br>";
print "Valor de salida 1=".$out1;
echo "</br>";
print "Valor de salida 2=".$out2;
echo "</br>";
}
}
?>
<?php
$sqlTxt= "SELECT ROWNUM, parts_code AS PARTS_CODE,
(parts_nm) AS PARTS_NM,
(parts_descr) AS PARTS_DESCR,
(loc_code) AS LOC_CODE,
(lot_code) AS LOT_CODE,
(stock_qty) AS STOCK_QTY,
DECODE('".$valueCustomer."',
'EXT',
'CUM',
'CUM',
'EF',
'CV',
'EF',
'LAM',
'CUMT',
'CUMT',
'EF') AS ".$ValueOPT1.",
DECODE('".$valueCustomer."', 'CUM', 'E.COM', 'CV', 'E.COM', 'CUMT', 'E.COM') AS ".$ValueOPT2.",
DECODE('".$valueCustomer."', 'CUM', 'EXT', 'CV', ' ', 'CUMT', 'LAM') AS ".$ValueOPT3."
from( select a.parts_code as parts_code,
b.parts_nm as parts_nm,
b.parts_descr as parts_descr,
a.wh_code as ".$valueLoc.",
a.rack_lot as ".$valueLot.",
a.stok_qty as stock_qty
from tmidstok a, tmimmatl b
where (a.parts_code like 'FM%' or a.parts_code like 'MV%')
and a.wh_code like 'M-%'
and a.wh_code <> 'M-000-Z'
and a.wh_code NOT IN ('M-000-Z','M-000-Y','TOT-U')
and b.parts_code = a.parts_code
and b.corp_code = a.corp_code
and b.fctry_code = a.fctry_code
and a.parts_code like '".$valueInqPart."'|| '%'
and a.corp_code ='TPH'
and a.fctry_code ='MG'
and '".$valueCustomer."'='EXT'
UNION ALL
select a.parts_code as parts_code,
b.parts_nm as parts_nm,
b.parts_descr as parts_descr,
a.wh_code as ".$valueLoc.",
a.rack_lot as ".$valueLot.",
a.stok_qty as stock_qty
from tmidstok a, tmimmatl b
where (a.parts_code like 'MB-PTM%')
and a.wh_code NOT IN ('T-000-Z','T-000-Y','E-00-F','E-000-C')
and b.parts_code = a.parts_code
and b.corp_code = a.corp_code
and b.fctry_code = a.fctry_code
and a.parts_code like '".$valueInqPart."'|| '%'
and a.corp_code ='TPH'
and a.fctry_code ='MG'
and '".$valueCustomer."'='LAM'
UNION ALL
select a.parts_code as parts_code,
b.parts_nm as parts_nm,
b.parts_descr as parts_descr,
a.wh_code as ".$valueLoc.",
a.rack_lot as ".$valueLot.",
a.stok_qty as stock_qty
from tmidstok a, tmimmatl b
where (a.parts_code like 'MB-PTM%')
and a.wh_code IN ('T-000-Z','T-000-Y')
and b.parts_code = a.parts_code
and b.corp_code = a.corp_code
and b.fctry_code = a.fctry_code
and a.parts_code like '".$valueInqPart."'|| '%'
and a.corp_code ='TPH'
and a.fctry_code ='MG'
and '".$valueCustomer."'='CUMT'
UNION ALL
select a.parts_code as parts_code,
b.parts_nm as parts_nm,
b.parts_descr as parts_descr,
a.wh_code as ".$valueLoc.",
a.rack_lot as ".$valueLot.",
a.stok_qty as stock_qty
from tmidstok a, tmimmatl b
where (a.parts_code like 'FM%'or a.parts_code like'MV%')
and a.wh_code = 'M-000-Y'
and b.parts_code = a.parts_code
and b.corp_code = a.corp_code
and b.fctry_code = a.fctry_code
and a.parts_code like '".$valueInqPart."' || '%'
and a.corp_code ='TPH'
and a.fctry_code ='MG'
and '".$valueCustomer."'= 'CUM'
UNION ALL
select a.parts_code as parts_code,
b.parts_nm as parts_nm,
b.parts_descr as parts_descr,
a.wh_code as ".$valueLoc.",
a.rack_lot as ".$valueLot.",
a.stok_qty as stock_qty
from tmidstok a, tmimmatl b
where a.wh_code = 'WHGL-U'
and b.parts_code = a.parts_code
and b.corp_code = a.corp_code
and b.fctry_code = a.fctry_code
and a.parts_code like '".$valueInqPart."'|| '%'
and a.corp_code ='TPH'
and a.fctry_code ='MG'
and '".$valueCustomer."'= 'CV')
order by 1, 3";
$stid=oci_parse($conn, $sqlTxt);
oci_execute($stid);
print"<table class='table table-bordred table-striped'>";
print"<thead >";
print"<th>#</th>";
print"<th>PARTS_CODE</th>";
print"<th>PARTS_NM</th>";
print"<th>PARTS_DESC</th>";
print"<th>LOC_CODE</th>";
print"<th>LOT_CODE</th>";
print"<th>STOCK_QTY </th>";
print"<th>OPT</th>";
print"<th>QUANTITY</th>";
print"</thead>";
echo "</br>";
$index = 0;
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)){
$index = $index +1;
echo"<tr>";
echo "<td><input type='checkbox' name='check_".$index."' value='".$row['PARTS_CODE']."' ></td>\n";
echo "<td > ".$row['PARTS_CODE']."</td>\n";
echo "<td > ".$row['PARTS_NM']."</td>\n";
echo "<td > ".$row['PARTS_DESCR']."</td>\n";
echo "<td > ".$row['LOC_CODE']."</td>\n";
echo "<td > ".$row['LOT_CODE']."</td>\n";
echo "<td > ".$row['STOCK_QTY']."</td>\n";
///Aqui es donde obtengo valores para mi checkbox.
print "<td ><input type='checkbox' onclick='validar(formulario.checkbox1,0)' name='checkbox1' value='".$row['OPT1']."'>".$row['OPT1']."";
print" <br>";
echo "<input type='checkbox' onclick='validar(formulario.checkbox2,0)' name='checkbox2' value='".$row['OPT2']."'>".$row['OPT2']."";
echo " <br>";
echo "<input type='checkbox' onclick='validar(formulario.checkbox3,0)' name='checkbox3' value='".$row['OPT3']."'>".$row['OPT3']."";
echo "</td>";
echo " <td><input type='number' name='issQty' placeholder='' value='".$valueIssQty."' required > </td>";
echo"</tr>";
}
echo "</table>";
?>
?>