我有csv文件,我在数据表中填充...使用php脚本......
SSW MGWNAME BOARDNO FRAMENO SLOTNO PORTNO E1 TID
DLHUGC01 NEHMGW01 0 1 2 0 0 2048-2079
DLHUGC01 NEHMGW01 0 1 2 0 1 2080-2111
DLHUGC01 NEHMGW01 0 1 2 0 2 2112-2143
DLHUGC01 NEHMGW01 0 1 2 0 3 2144-2175
DLHUGC01 NEHMGW01 0 1 2 0 4 2176-2207
DLHUGC01 NEHMGW01 0 1 2 0 5 2208-2239
DLHUGC01 NEHMGW01 0 1 2 0 6 2240-2271
DLHUGC01 NEHMGW01 0 1 2 0 7 2272-2303
DLHUGC01 NEHMGW01 0 1 2 0 8 2304-2335
DLHUGC01 NEHMGW01 0 1 2 0 9 2336-2367
DLHUGC01 NEHMGW01 0 1 2 0 10 2368-2399
DLHUGC01 NEHMGW01 0 1 2 0 11 2400-2431
DLHUGC01 NEHMGW01 0 1 2 0 12 2432-2463
DLHUGC01 NEHMGW01 0 1 2 0 13 2464-2495
现在上面的csv文件正在以表格格式化......使用数据表,
这是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<title>DataTables example - Form inputs</title>
<link rel="stylesheet" type="text/css" href="../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../resources/demo.css">
<style type="text/css" class="init">
</style>
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="../resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../resources/demo.js"></script>
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
var table = $('#example').DataTable();
$('button').click( function() {
var data = table.$('input, select').serialize();
alert(
"The following data would have been submitted to the server: \n\n"+
data.substr( 0, 120 )+'...'
);
return false;
} );
} );
</script>
</head>
<body class="dt-example">
<button type="submit">Submit form</button>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>SSW</th>
<th>MGWNAME</th>
<th>BOARDNO</th>
<th>FRAMENO</th>
<th>SLOTNO</th>
<th>PORTNO</th>
<th>E1</th>
<th>TID</th>
<th>TG</th>
<th>CIC</th>
<th>OPC</th>
<th>DPC</th>
<th>SLC</th>
<th>NLDTRAILID</th>
<th>CircleTRAILID</th>
<th>USERLABEL</th>
<th>MGW-NLDHandoverDetails</th>
<th>NA</th>
<th>NA</th>
<th>NA</th>
</tr>
</thead>
<tbody>
<?php
$f = fopen("LDHUAWEI.csv", "r");
while (($line = fgetcsv($f)) !== false)
{
echo "<tr id='tr_data'>";
$i=1;
foreach ($line as $cell)
{
echo "<td><input type='text' id='row-".$i."-age' name='row-".$i."-age' value=".$cell."></td>";
$i++;
}
echo "</tr>\n";
}
fclose($f);
?>
</tbody>
</table>
</body>
</html>
我已经回显了循环中的输入文本以及值传递的值..现在用户编辑并从按钮发送提交...它必须在csv文件中更改...
表中的特定值应写入csv文件中......获取编辑值的整行并写入csv文件...
感谢..