好的,所以我在呼叫中心工作,我们有一个显示器可以显示每个呼叫者的休息时间。我是这家公司的新手,已经接到了为这台显示器制作网站的任务。
下面是我的php代码。我已经搜索了可能是什么问题的时间,但我似乎找不到它。
问题是:如果我单击按钮,那么我的表单不会被发布并且不会写入 csv。该代码以前工作过,所以在主要行中我知道我的代码是正确的。它一定是一些愚蠢而小的东西,但我就是找不到它。
我的代码:
<html>
<head>
<LINK REL="StyleSheet" HREF="Input_form.css">
<title>Verander Plaatsindeling</title>
<h1><center>Verander plaatsindeling<center></h1>
<hr/>
</head>
<body>
<?php
if(ISSET($_POST['submitMe']))
{
$csv = fopen("zitplaatsenAntwerpen.csv","w") or die("Kan csv niet vinden!");
for($counter=1;$counter<=30;$counter++)
{
$naam = $_POST["Naam" .$counter];
$project = $_POST["Project" .$counter];
$csvrow = $counter . ";" . $naam . ";" . $project . "\n";
fwrite($csv, $csvrow);
}
?>
<?php
fclose($csv);
echo "<SCRIPT LANGUAGE='JavaScript'>
<!--
window.alert('Gegevens ingeladen!')
// -->
</SCRIPT>";
$informatie = array();
$f = fopen("ZitplaatsenAntwerpen.csv","r") or die("Kan csv niet vinden!");
while (!feof($f))
{
$arrM = explode(";",fgets($f));
$informatie[$arrM[0]]["Nummer"] = ucwords($arrM[0]);
$informatie[$arrM[0]]["Naam"] = ucwords($arrM[1]);
$informatie[$arrM[0]]["Project"] = ucwords($arrM[2]);
}
fclose($f);
}
else
{
$informatie = array();
$f = fopen("ZitplaatsenAntwerpen.csv", "r") or die("Kan csv niet vinden!");
while (!feof($f))
{
$arrM = explode(";",fgets($f));
$informatie[$arrM[0]]["Nummer"] = ucwords($arrM[0]);
$informatie[$arrM[0]]["Naam"] = ucwords($arrM[1]);
$informatie[$arrM[0]]["Project"] = ucwords($arrM[2]);
}
fclose($f);
}
?>
<div style="word-spacing:7em;" align:center>
Nummer Naam Project
</div>
<pre><form action="<?php echo $PHP_SELF;?>" method="post">
<?php
for ($teller = 1;$teller<=30; $teller++)
{
if(!empty($informatie[$teller]))
{
echo "<div align:center>";
echo " " . $teller . " ";
echo "<input type='text' name='Naam" .$teller. "' value='";
echo $informatie[$teller]["Naam"] . "'>";
echo "<input id='" .$teller. "' ";
echo "<input type='text' name='Project" .$teller. "' value='";
echo $informatie[$teller]["Project"] . "'>";
echo "</div>";
}
else
{
echo "<div align:center>";
echo " " . $teller . " ";
echo "<input type='text' name='Naam" .$teller. "' value='";
echo $informatie[$teller]["Naam"] . "'>";
echo "<input id='" .$teller. "' ";
echo "<input type='text' name='Project" .$teller. "' value='";
echo $informatie[$teller]["Project"] . "'>";
echo "</div>";
}
}
?>
</form></pre>
<div align="center">
<button style="width:100;height:50" type="submit" name="submitMe">Opslaan</button>
</div>
</body>
</html>
任何帮助,将不胜感激。谢谢大家