再退回首页前,用户无论是否修改数据都要点保存,我设置了js提示,但是万一点错,数据就全没了,我想只在文件里写入修改的数据,若是判断数组的该值为空则不执行fwrite,但是行不通,求大牛之指教
<?php
error_reporting(4);
?>
<div>
<table id="AAP">
<form action="tableAAP.php" method="post">
<thead>
</thead>
<tbody id="content">
<tr>
<th>Segment</th>
<th>Function</th>
<th>2014  </th>
<th>2015  </th>
<th>2016  </th>
<th>2017  </th>
<th>2018  </th>
</tr>
<?php
$filename="AAPvaleurs.txt";
$file_hwnd=fopen($filename,"r");
$content = fread($file_hwnd, filesize($filename));
fclose($file_hwnd);
$AAP2 = unserialize($content);
?>
<tr class="premium">
<td class="premium">Premium</td>
<td class="productline">Product Line</td>
<td><input type="text" class="edit" id="PP11" name="PP11" required="" value=<?php echo $AAP2[0]?> ></td>
<td><input type="text" class="edit" id="PP12" name="PP12" required="" value=<?php echo $AAP2[1]?> ></td>
<td><input type="text" class="edit" id="PP13" name="PP13" required="" value=<?php echo $AAP2[2]?> ></td>
<td><input type="text" class="edit" id="PP14" name="PP14" required="" value=<?php echo $AAP2[3]?> ></td>
<td><input type="text" class="edit" id="PP15" name="PP15" required="" value=<?php echo $AAP2[4]?> ></td>
</tr>
<tr class="premium">
<td class="premium">Premium</td>
<td class="design">Design</td>
<td><input type="text" class="edit" id="PD11" name="PD11" required="" value=<?php echo $AAP2[5]?> ></td>
<td><input type="text" class="edit" id="PD12" name="PD12" required="" value=<?php echo $AAP2[6]?> ></td>
<td><input type="text" class="edit" id="PD13" name="PD13" required="" value=<?php echo $AAP2[7]?> ></td>
<td><input type="text" class="edit" id="PD14" name="PD14" required="" value=<?php echo $AAP2[8]?> ></td>
<td><input type="text" class="edit" id="PD15" name="PD15" required="" value=<?php echo $AAP2[9]?> ></td>
</tr>
<tr class="value">
<td class="value">Value</td>
<td class="technologyeng">Technology Eng</td>
<td><input type="text" class="edit" id="VT11" name="VT11" required="" value=<?php echo $AAP2[40]?> ></td>
<td><input type="text" class="edit" id="VT12" name="VT12" required="" value=<?php echo $AAP2[41]?> ></td>
<td><input type="text" class="edit" id="VT13" name="VT13" required="" value=<?php echo $AAP2[42]?> ></td>
<td><input type="text" class="edit" id="VT14" name="VT14" required="" value=<?php echo $AAP2[43]?> ></td>
<td><input type="text" class="edit" id="VT15" name="VT15" required="" value=<?php echo $AAP2[44]?> ></td>
</tr>
<tr class="value">
<td class="value">Value</td>
<td class="simulation">Simulation</td>
<td><input type="text" class="edit" id="VS11" name="VS11" required="" value=<?php echo $AAP2[45]?> ></td>
<td><input type="text" class="edit" id="VS12" name="VS12" required="" value=<?php echo $AAP2[46]?> ></td>
<td><input type="text" class="edit" id="VS13" name="VS13" required="" value=<?php echo $AAP2[47]?> ></td>
<td><input type="text" class="edit" id="VS14" name="VS14" required="" value=<?php echo $AAP2[48]?> ></td>
<td><input type="text" class="edit" id="VS15" name="VS15" required="" value=<?php echo $AAP2[49]?> ></td>
</tr>
<tr class="base">
<td class="base">Base</td>
<td class="imds">IMDS</td>
<td><input type="text" class="edit" id="BI11" name="BI11" required="" value=<?php echo $AAP2[80]?> ></td>
<td><input type="text" class="edit" id="BI12" name="BI12" required="" value=<?php echo $AAP2[81]?> ></td>
<td><input type="text" class="edit" id="BI13" name="BI13" required="" value=<?php echo $AAP2[82]?> ></td>
<td><input type="text" class="edit" id="BI14" name="BI14" required="" value=<?php echo $AAP2[83]?> ></td>