[eluser]Unknown[/eluser]
I have problems with deleting jobs... In order to delete jobs, I have to enter the Job ID.. but it seems like its not working...
deletejob.php
<form action="deletejob1.php" method="post">
<center><br><br>
<table border="0" cellspacing="10" bgcolor="CCFF66" class="delete">
<tr>
<td colspan="2"><p class="one"> Enter Job ID: </td>
<td colspan="2"><input type="text" id="jobid" name="jobid"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Delete Job"></td>
</tr>
<tr>
<td>
<?php
$currfile = "jobs.txt";
if(file_exists($currfile))
{
$file = fopen("jobs.txt", "r");
while (!feof($file))
{
$display = fgets($file);
if ($display == null)
break;
$arrayList = explode("--",$display);
if ($_SESSION['id'] == $arrayList[1])
{
echo "Job ID: ".$arrayList[0]."<br/>";
echo "Company Name: ".$arrayList[3]."<br/>";
echo "Headquarters: ".$arrayList[4]."<br/>";
echo "Job hiring: ".$arrayList[5]."<br/>";
echo "Job Type: ".$arrayList[6]."<br/>";
echo "Contact Number: ".$arrayList[7]."<br/>";
echo "Email: ".$arrayList[8]."<br/>";
echo "<hr><br/>";
}
}
fclose ($file);
}
else {
echo "Details not found. Try again";
}
?></td>
</tr>
</table>
</form>
deletejob1.php
<?php
session_start();
$fp = fopen("jobs.txt","r");
$jobid = $_POST['jobid'];
while (!feof($fp)) {
$display = fgets($fp);
if ($display == null)
break;
$data = explode("--",$display);
if (($jobid == $data[0]) && ($_SESSION['id'] == $data[1]))
{
}
else
fwrite($fp,$display);
}
fclose($fp);
header("location:deletejob.php");
?>