<?php
ob_start();
include("sys.php");
session_start();//when nid use session nid put tis
?>
<html>
<title></title><head></head>
<script type="text/javascript">
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
var cellLeft = row.insertCell(0);
var e0 = document.createElement('input');
e0.type = 'checkbox';
e0.name = 'txtRow[]' ;
e0.id = 'txtRow' + iteration;
e0.size = 10;
cellLeft.appendChild(e0);
var cellLeft0 = row.insertCell(1);
var e01 = document.createElement('select');
e01.name = 'txtRow[]' + iteration;
e01.options[0] = new Option('Select one', 'value0');
e01.options[1] = new Option('A122', 'value1');
e01.options[2] = new Option('A014', 'value2');
e01.style.width=96;
cellLeft0.appendChild(e01);
// left cell
var cellLeft = row.insertCell(2);
var e1 = document.createElement('input');
e1.type = 'text';
e1.name = 'txtRow[]' + iteration;
e1.id = 'txtRow' + iteration;
e1.size = 30;
e1.readOnly='true';
cellLeft.appendChild(e1);
// right cell
var cellRight = row.insertCell(3);
var e2 = document.createElement('input');
e2.type = 'text';
e2.name = 'txtRow[]' + iteration;
e2.id = 'txtRow' + iteration;
e2.size = 4;
cellRight.appendChild(e2);
// right cell
var cellRight3 = row.insertCell(4);
var e3 = document.createElement('input');
e3.type = 'text';
e3.name = 'txtRow[]' + iteration;
e3.id = 'txtRow' + iteration;
e3.size = 5;
cellRight3.appendChild(e3);
// right cell
var cellRight4 = row.insertCell(5);
var e4 = document.createElement('input');
e4.type = 'text';
e4.name = 'txtRow[]' + iteration;
e4.id = 'txtRow' + iteration;
e4.size = 40;
cellRight4.appendChild(e4);
// right cell
var cellLeft5 = row.insertCell(6);
var e5 = document.createElement('select');
e5.name = 'txtRow[]' + iteration;
e5.options[0] = new Option('A014', 'value0');
e5.options[1] = new Option('A122', 'value1');
e5.options[2] = new Option('B189', 'value2');
e5.options[3] = new Option('B190', 'value3');
e5.options[4] = new Option('B187', 'value4');
e5.style.width=75;+
cellLeft5.appendChild(e5);
// right cell
var cellRight6 = row.insertCell(7);
var e6 = document.createElement('input');
e6.type = 'text';
e6.name = 'txtRow[]' + iteration;
e6.id = 'txtRow' + iteration;
e6.size = 40;
e6.readOnly='true';
cellRight6.appendChild(e6);
// right cell
var cellRight7 = row.insertCell(8);
var e7 = document.createElement('input');
e7.type = 'text';
e7.name = 'txtRow[]' + iteration;
e7.id = 'txtRow' + iteration;
e7.size = 10;
e7.value="<?php echo date('Y-m-d');?>"
e7.readOnly='true';
cellRight7.appendChild(e7);
}
function removeRowFromTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function openInNewWindow(frm)
{
// open a blank window
var aWindow = window.open('', 'TableAddRowNewWindow',
'scrollbars=yes,menubar=yes,resizable=yes,toolbar=no,width=400,height=400');
// set the target to the blank window
frm.target = 'TableAddRowNewWindow';
// submit
frm.submit();
}
function validateRow(frm)
{
var chkb = document.getElementById('chkValidate');
if (chkb.checked) {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length - 1;
var i;
for (i=1; i<=lastRow; i++) {
var aRow = document.getElementById('txtRow' + i);
if (aRow.value.length <= 0) {
alert('Row ' + i + ' is empty');
return;
}
}
}
openInNewWindow(frm);
}
function Check(chk)
{
if(document.frm.Check_All.value=="Check All")
{
for (i=0;i< chk.length; i++)
chk[i].checked = true ;
document.frm.Check_All.value="UnCheck All";
}
else
{ for (i=0;i< chk.length; i++)
chk[i].checked = false ;
document.frm.Check_All.value="Check All";
}
}
</script>
<body>
<form action="" method="post" name="frm">
<?php
$uuuu=$_SESSION["userid"];
$result=mysql_query("select username from fcm_user where userid='$uuuu'");
$row=mysql_fetch_assoc($result);
?>
<table border="0"><tr><th>Welcome xxx <?php echo $row['username'];?></th>
</tr></table>
<h4>TYPE : STATIONARY
</h4>
<table border="1" id="tblSample">
<tr>
<th><table border="0"><input type="checkbox" value="" id="selectall"></table></th>
<th width="5%">ITEM CODE</th>
<th width="20%">DESCRIPTION</th>
<th width="10%">Qty</th>
<th width="5%">Units</th>
<th width="20%">Reason</th>
<th width="5%">Request QC No.</th>
<th width="20%">Name</th>
<th width="5%">Request Date</th>
</tr>
<tr>
<td><table border="0"><input type="checkbox" value="" name="check_list" ></table></td>
<td>
<select name="txtcode" onChange="javascript:ShowSelected(this)">
<option value="" selected>Select one</option>
<?php
$result2=mysql_query("select * from fcm_e_item where item_type='S'");
while($row2=mysql_fetch_assoc($result2)){
?>
<option value="<?php echo $row2['item_code'];?>"><?php echo $row2['item_code'];?></option><?php } ?>
</select>
</td>
<td><input type="text" name="txtdesc" value="" size="30" readonly="true"></td>
<td><input type="text" name="txtqty" value=""size="4"></td>
<td><input type="text" name="txtuom" value=""size="5"></td>
<td><input type="text" name="txtreason" value=""size="40"></td>
<td><select name="txtreq_qc">
<?php
$result4=mysql_query("select * from fcm_employee");
while($row4=mysql_fetch_assoc($result4)){
?>
<option value="<?php echo $row4['employeeno'];?>"><?php echo $row4['employeeno'];?></option> <?php } ?></select>
</td>
<td><input type="text" name="txtname" value=""size="40" readonly="true"></td>
<td><input type="text" name="txtrdate" size="10" value="<?php echo date('Y-m-d');?>" readonly="true"></td></tr>
</table>
<input type="button" name="Check_All" value="Check All" onClick="Check(document.frm.check_list)">
<input type="button" value="Add" onClick="addRowToTable();" />
<input type="button" value="Remove" onClick="removeRowFromTable();" /><br><br>
<input type="submit" value="Edit" name="editbtn" id="a"/>
<input type="submit" value="Delete" name="deletebtn" id="b"/>
<div align="right">
<input type="submit" value="Save/Send" name="savebtn" onClick="openInNewWindow(frm);"/>
<input type="submit" value="Close" name="closebtn"/>
</form>
</body>
</html>
quincy.89 0 Newbie Poster
<?php
ob_start();
include("sys.php");
session_start();//when nid use session nid put tis
?>
<html>
<title></title><head></head>
<script type="text/javascript">
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
var cellLeft = row.insertCell(0);
var e0 = document.createElement('input');
e0.type = 'checkbox';
e0.name = 'txtRow[]' ;
e0.id = 'txtRow' + iteration;
e0.size = 10;
cellLeft.appendChild(e0);
var cellLeft0 = row.insertCell(1);
var e01 = document.createElement('select');
e01.name = 'txtRow[]' + iteration;
e01.options[0] = new Option('Select one', 'value0');
e01.options[1] = new Option('A122', 'value1');
e01.options[2] = new Option('A014', 'value2');
e01.style.width=96;
cellLeft0.appendChild(e01);
// left cell
var cellLeft = row.insertCell(2);
var e1 = document.createElement('input');
e1.type = 'text';
e1.name = 'txtRow[]' + iteration;
e1.id = 'txtRow' + iteration;
e1.size = 30;
e1.readOnly='true';
cellLeft.appendChild(e1);
// right cell
var cellRight = row.insertCell(3);
var e2 = document.createElement('input');
e2.type = 'text';
e2.name = 'txtRow[]' + iteration;
e2.id = 'txtRow' + iteration;
e2.size = 4;
cellRight.appendChild(e2);
// right cell
var cellRight3 = row.insertCell(4);
var e3 = document.createElement('input');
e3.type = 'text';
e3.name = 'txtRow[]' + iteration;
e3.id = 'txtRow' + iteration;
e3.size = 5;
cellRight3.appendChild(e3);
// right cell
var cellRight4 = row.insertCell(5);
var e4 = document.createElement('input');
e4.type = 'text';
e4.name = 'txtRow[]' + iteration;
e4.id = 'txtRow' + iteration;
e4.size = 40;
cellRight4.appendChild(e4);
// right cell
var cellLeft5 = row.insertCell(6);
var e5 = document.createElement('select');
e5.name = 'txtRow[]' + iteration;
e5.options[0] = new Option('A014', 'value0');
e5.options[1] = new Option('A122', 'value1');
e5.options[2] = new Option('B189', 'value2');
e5.options[3] = new Option('B190', 'value3');
e5.options[4] = new Option('B187', 'value4');
e5.style.width=75;+
cellLeft5.appendChild(e5);
// right cell
var cellRight6 = row.insertCell(7);
var e6 = document.createElement('input');
e6.type = 'text';
e6.name = 'txtRow[]' + iteration;
e6.id = 'txtRow' + iteration;
e6.size = 40;
e6.readOnly='true';
cellRight6.appendChild(e6);
// right cell
var cellRight7 = row.insertCell(8);
var e7 = document.createElement('input');
e7.type = 'text';
e7.name = 'txtRow[]' + iteration;
e7.id = 'txtRow' + iteration;
e7.size = 10;
e7.value="<?php echo date('Y-m-d');?>"
e7.readOnly='true';
cellRight7.appendChild(e7);
}
function removeRowFromTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function openInNewWindow(frm)
{
// open a blank window
var aWindow = window.open('', 'TableAddRowNewWindow',
'scrollbars=yes,menubar=yes,resizable=yes,toolbar=no,width=400,height=400');
// set the target to the blank window
frm.target = 'TableAddRowNewWindow';
// submit
frm.submit();
}
function validateRow(frm)
{
var chkb = document.getElementById('chkValidate');
if (chkb.checked) {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length - 1;
var i;
for (i=1; i<=lastRow; i++) {
var aRow = document.getElementById('txtRow' + i);
if (aRow.value.length <= 0) {
alert('Row ' + i + ' is empty');
return;
}
}
}
openInNewWindow(frm);
}
function Check(chk)
{
if(document.frm.Check_All.value=="Check All")
{
for (i=0;i< chk.length; i++)
chk[i].checked = true ;
document.frm.Check_All.value="UnCheck All";
}
else
{ for (i=0;i< chk.length; i++)
chk[i].checked = false ;
document.frm.Check_All.value="Check All";
}
}
</script>
<body>
<form action="" method="post" name="frm">
<?php
$uuuu=$_SESSION["userid"];
$result=mysql_query("select username from fcm_user where userid='$uuuu'");
$row=mysql_fetch_assoc($result);
?>
<table border="0"><tr><th>Welcome xxx <?php echo $row['username'];?></th>
</tr></table>
<h4>TYPE : STATIONARY
</h4>
<table border="1" id="tblSample">
<tr>
<th><table border="0"><input type="checkbox" value="" id="selectall"></table></th>
<th width="5%">ITEM CODE</th>
<th width="20%">DESCRIPTION</th>
<th width="10%">Qty</th>
<th width="5%">Units</th>
<th width="20%">Reason</th>
<th width="5%">Request QC No.</th>
<th width="20%">Name</th>
<th width="5%">Request Date</th>
</tr>
<tr>
<td><table border="0"><input type="checkbox" value="" name="check_list" ></table></td>
<td>
<select name="txtcode" onChange="javascript:ShowSelected(this)">
<option value="" selected>Select one</option>
<?php
$result2=mysql_query("select * from fcm_e_item where item_type='S'");
while($row2=mysql_fetch_assoc($result2)){
?>
<option value="<?php echo $row2['item_code'];?>"><?php echo $row2['item_code'];?></option><?php } ?>
</select>
</td>
<td><input type="text" name="txtdesc" value="" size="30" readonly="true"></td>
<td><input type="text" name="txtqty" value=""size="4"></td>
<td><input type="text" name="txtuom" value=""size="5"></td>
<td><input type="text" name="txtreason" value=""size="40"></td>
<td><select name="txtreq_qc">
<?php
$result4=mysql_query("select * from fcm_employee");
while($row4=mysql_fetch_assoc($result4)){
?>
<option value="<?php echo $row4['employeeno'];?>"><?php echo $row4['employeeno'];?></option> <?php } ?></select>
</td>
<td><input type="text" name="txtname" value=""size="40" readonly="true"></td>
<td><input type="text" name="txtrdate" size="10" value="<?php echo date('Y-m-d');?>" readonly="true"></td></tr>
</table>
<input type="button" name="Check_All" value="Check All" onClick="Check(document.frm.check_list)">
<input type="button" value="Add" onClick="addRowToTable();" />
<input type="button" value="Remove" onClick="removeRowFromTable();" /><br><br>
<input type="submit" value="Edit" name="editbtn" id="a"/>
<input type="submit" value="Delete" name="deletebtn" id="b"/>
<div align="right">
<input type="submit" value="Save/Send" name="savebtn" onClick="openInNewWindow(frm);"/>
<input type="submit" value="Close" name="closebtn"/>
</form>
</body>
</html>
Edited by mike_2000_17 because: Fixed formatting
smantscheff commented: You're wasting your time, and ours too. +0
debasisdas 580 Posting Genius Featured Poster
Who do you think is going to read all these.
You need to point to the exact line of code that is causing any error.
quincy.89 0 Newbie Poster
the problem is the data input cannot store into database
debasisdas 580 Posting Genius Featured Poster
Read my previous post and point to the line that you think is causing the problem.
As this place is for MySQ avoid posting all your PHP / HTML code here.
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.