Please help my code is not working
here is my code:
<html>
<head>
<title>Visitors.php</title>
</head>
<body>
<table border="1" width = "50%">
<tr>
<th width = "20%"> Postcode </th>
<th width = "10%"> Pictures </th>
<th width = "5%"> Price </th>
<th width = "5%"> Visitors </th>
<tr>
<?
$filename = "house.txt";
$filepointer = fopen($filename,"r");
$myarray = file ($filename);
for ($mycount = 0; $mycount < count($myarray); $mycount++ )
{
$postcode[$mycount] = getvalue($myarray[$mycount],0);
$price[$mycount] = getvalue($myarray[$mycount],1);
$picture[$mycount] = getvalue($myarray[$mycount],2);
$visits[$mycount] = getvalue($myarray[$mycount],3);
foreach($_REQUEST as $key => $value) {
if($value != "on"){
}
else
{
$visits[$key] = $visits[$key] + 1;
}
}
$cbname='box'.$mycount;
print'<tr> <td>'. $picture[$mycount].
'</td><td>'. $postcode[$mycount].
'</td><td>'. $price[$mycount].
'</td><td>'. $visits[$mycount] .
'</td></tr>';
}
?>
</table>
<?
fclose ($filepointer);
function getvalue ($text, $commaToLookFor)
{
$intoarray = explode(",",$text);
return $intoarray[ $commaToLookFor];
}
if (!($filepointer = fopen($filename,"r"))) { exit; }
?>
</body>
</html>
For some reason it prints out like this:
$value) { if($value != "on") { } else { $visits[$key] = $visits[$key] + 1; } } $cbname='box'.$mycount; print "'; } ?>
Image Postcode Price No. Of Visits
$partdetails[0]"; print " $partdetails[1]"; print " $partdetails[2]"; print " $partdetails[3]"; '