This is HTML file
<html>
<body>
<h1><font color="red"> Search for Property</font></h1>
Please fill in the area to get the property you are looking for. <BR>
<form action="psearch.php" method="post">
<table>
<tr>
</tr>
<tr>
</tr>
<td>
Property Type:
</td>
<td>
<input type="checkbox" name="house" value="house"> House
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="checkbox" name="flat" value="flat"> Flat
</td>
</tr>
<tr>
<td>
Maximum Price in thousand <br>
eg. Enter '12' for £12,000:
</td>
<td>
<input type="text" name="maximum">
</td>
</tr>
<tr>
<td>
</td>
<td><input type="submit" value="Submit">
</td>
</tr>
</table></form></body>
</html>
PHP FILE
<?php
$maximum=$POST["maximum"];
$house=$POST["house"];
$flat=$_POST["flat"];
print"$house $flat";
$plist = "House.txt";
$filepointer = fopen($plist,"r");
$propertyArray = file ($plist);
print"<table>";
for ( $myCount = 0; $myCount < 1; $myCount++)
{
$aline = $propertyArray[$myCount];
print"<tr align=\"center\" style=\"text-transform: uppercase\"><strong>";
for ($myCount1 = 0; $myCount1 < count ($aline); $myCount1++)
{
$seperate = explode (",",$aline);
$postcode = $seperate[0];
$price = $seperate[1];
$image = $seperate[2];
$visits = $seperate[3];
print "<td>$postcode</td><td></td><td>$price</td><td></td><td>$image</td><td></td><td>$visits</td>";
}
print "</strong></tr>";
}
for ( $myCount = 1; $myCount < count ($propertyArray); $myCount++)
{
$aline = $propertyArray[$myCount];
print"<tr>";
for ($myCount1 = 0; $myCount1 < count ($aline); $myCount1++)
{
$seperate = explode (",",$aline);
$postcode = $seperate[0];
$price = $seperate[1];
$image = $seperate[2];
$visits = $seperate[3];
#________________________________________
#if(substr($flat,0,4)==substr($image,0,4))
{
print "<td align=\"center\">$postcode</td><td></td><td align=\"center\">$price</td><td></td><td align=\"center\">$image</td><td></td><td align=\"center\">$visits</td>";
}
#if(substr($house,0,5)==substr(&image,0,5))
{
print "<td align=\"center\">$postcode</td><td></td><td align=\"center\">$price</td><td></td><td align=\"center\">$image</td><td></td><td align=\"center\">$visits</td>";
}
}
print "</tr>";
}
print"</table>";
fclose ($filepointer);
print"<html><form><input type=\"button\" value=\"Go Back\" onClick=\"history.go(-1);\">";
?>
Hello,
I need a help with this code
if(substr($house,0,5)==substr(&image,0,5))
$house can be either null or the string "house"
this should compare with $image
$image contains the string "flat1.jpg" or "house1.jpg"
if both are the same it should print s.th
I was trying with substr($image,0,4)
then the string would have flat instead flat1.jpg