|
|
|
click checkbox ตามรายการที่เลือก แล้วบันทืกใน btn save php ช่วยผมที่ ขอคพแนะนำวิธีทำด้วยครับ |
|
|
|
|
|
|
|
< frminsert_bill_out.php >
Code (PHP)
<?php
session_start();
ob_start();
$AdminID=$_SESSION['lAdminID'];
$BillNo=$_GET['BillNo'];
echo $Bill;
echo $BillNo;
echo $AdminID;
include("include/db_connect.php");
include("include/function.php");
if((isset($_SESSION['login_true_administrator'])) or (isset($_SESSION['login_true_AdminID'])))
{
?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="css/textcss.css" type="text/css" rel="stylesheet" >
<link href="css/styleinput.css" type="text/css" rel="stylesheet" >
<link href="css/stylelink.css" type="text/css" rel="stylesheet">
<script language="JavaScript">
function ClickCheckAll(vol)
{
var i=1;
for(i=1;i<=document.frm.hdnCount.value;i++)
{
if(vol.checked == true)
{
eval("document.frm.Chk"+i+".checked=true");
}
else
{
eval("document.frm.Chk"+i+".checked=false");
}
}
}
function onINSERT()
{
if(confirm('Do you want to INSERT ?')==true)
{
return true;
}
else
{
return false;
}
}
</script>
<?php
$select="SELECT bill_id.BillNo, bill_id.Date, bill_id.AdminID, bill_id.DeptID
FROM stock_d.bill_id
WHERE (bill_id.BillNo ='$BillNo')
AND (bill_id.AdminID ='$AdminID')
GROUP BY bill_id.BillNo";
$sqlselect=mysql_query($select) or die ("show errors ::".mysql_error());
?>
<form action="insert_supplier.php" method="post" enctype="multipart/form-data" name="frm" onsubmit="return onINSERT();">
<?php
while($row=mysql_fetch_array($sqlselect))
{
?>
<table width="50%" border="1" align="center"cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" style='BORDER-COLLAPSE: collapse'>
<tr>
<td></td>
</tr>
<tr>
<td colspan="2" align="center"><p> </p>
<p>FROM : Materail Request and List Supplier Selected
</p>
<p> </p></td>
</tr>
<tr>
<td>ເລກທີ່ໃບບິນ</td>
<td><input type="text" name="BillNo" id="BillNo" value="<?php echo $row['BillNo'];?>" /></td>
</tr>
<tr>
<td width="10%">ຊື່ ແລະ ນາມສະກຸນ Name & Surname :</td>
<td width="10%"><?php echo $_SESSION['lname'];?></td>
</tr>
<tr>
<td width="10%">ລະຫັດພະແນກ :</td>
<td width="10%"><?php echo $_SESSION['lDeptID'];?></td>
</tr>
<tr>
<td width="10%">ຊື່ພະແນກ : </td>
<td width="10%"><?php echo $_SESSION['lDeptName'];?></td>
</tr>
<tr>
<td width="10%">ວັນທີ່ / ເດືອນ / ປີ :</td>
<td width="10%"><?php echo $row['Date'];?></td>
</tr>
<?php } ?>
</table>
<br />
<?php
$Product="SELECT * FROM stock_d.stock_main";
$sqlProduct=mysql_query($Product) or die("Show Error :: ".mysql_error());
?>
<table width="45%" border="1" align="LEFT" cellpadding="1" cellspacing="1" bordercolor="#CCCCCC" style='BORDER-COLLAPSE: collapse'>
<thead>
<tr>
<td width="5" class="Txt1" >ProductID</td>
<td width="5" class="Txt1">Name</td>
<td width="5" class="Txt1">NameLao</td>
<td width="4" class="Txt1" >QTY</td>
<td width="4" class="Txt1">KindID</td>
<td width="4" class="Txt1">Select</td>
</tr>
</thead>
<tbody>
<?php
$i=0;
while($row=mysql_fetch_array($sqlProduct))
{
?>
<?php ?>
<tr>
<td class="Txt1"><input type="text" name="ProductID[]" id="ProductID[]" value="<?php echo $row['ProductID'];?>" /></td>
<td class="Txt1"><?php echo $row['Name']; ?></td>
<td class="Txt1"><?php echo $row['NameLao']; ?></td>
<td class="Txt1"><input name="QTY[]" type="number" class="hover" id="QTY[]"/></td>
<td class="Txt1"><input name="KindID[]" type="text" class="hover" id="KindID[]"/></td>
<td align="center"><input type="checkbox" name="Chk[]" id="Chk<?php echo $i;?>" value="<?php echo $row["ProductID"];?>"></td>
</tr>
<?php } ?>
</tbody>
<tr>
<input type="hidden" name="hdnCount" value="<?php echo $i;?>">
<td colspan="4"><input type="submit" name="ok" id="ok" value="Save" class="myButton1" /></td>
<td colspan="5"><input type="reset" name="clear" id="clear" value="clear" class="myButton1" />
</td>
</tr>
<tr>
<td colspan="9"> </td>
</tr>
<tr>
<td colspan="10"></td>
</tr>
</table>
<?php
ob_end_flush();
mysql_close($d1,$db1,$c1);
mysql_close($d2,$db2,$c1);
exit();
?>
</form>
<?php } ?>
|
|
|
|
|
Date :
2017-05-17 10:46:11 |
By :
Bouasavanh HararRock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insert_supplier.php
Code (PHP)
<?php
session_start();
ob_start();
$BillNo=$_SESSION['lBillNo'];
echo $BillNo;
include("include/db_connect.php");
include("include/function.php");
if((isset($_SESSION['login_true_administrator'])) or (isset($_SESSION['login_true_AdminID'])))
{
?>
<?php
$BillNo=$_POST['BillNo'];
// check 1 or not ແລ້ວ ເລືອກໃຫ້ເປັນ Check already
$Do=$_POST['Chk'];
if(isset($_POST['saved']))
{
if(empty($Do)|| $DO ==0) {
echo "Please Select Materail Supplier List after Click Save!!";
}else{
foreach($_POST['Chk'] as $i){
$sql="INSERT INTO stock_d.bill_out(CodeOut,BillNo,ProductID,QTY,KindID,TypeID,Remark)
VALUES('','$BillNo','{$_POST['ProductID'][$i]}','{$_POST['QTY'][$i]}','{$_POST['KindID'][$i]}','{$_POST['TypeID'][$i]}','{$_POST['Remark'][$i]}') ";
$objSQl=mysql_query($sql) or die ("show errors ::".mysql_error());
if($objSQl){
echo "<script>alert('Save it !!!');</script>";
}else{
echo "<meta http-equiv='refresh' content='0;url=frminsert_bill_out.php'>";
echo "<script>alert('Can't Dose that !!!');</script>";
}
}
}
}
?>
<?php }?>
<?php
ob_end_flush();
mysql_close($d1,$db1,$c1);
mysql_close($d2,$db2,$c1);
exit();
?>
|
|
|
|
|
Date :
2017-05-17 10:47:07 |
By :
Bouasavanh HararRock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำได้แล้ว ครับ THanK you
|
|
|
|
|
Date :
2017-05-18 08:56:31 |
By :
Bouasavanh HararRock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|