Ok so i'm working in a callcenter and we have a monitor that shows the breaks every caller has taken. I'm new to this company and have gotton the assignment to make a website for this monitor.
below is my php code. I have searched for houres on what might be the problem but i can't seem to find it.
The problem is : if i click the button then my form doesnt get posted and doesnt write to csv. The code has worked before so in the main lines I know my code is correct. It must be something silly and small but I just can't find it.
My code :
<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>
Any help would be appreciated. Thank you all in advance