Hi, i've been asked to create a visit counter using checkboxes and a submit button. When a form (available form - code below) is submitted (pressed visit button) a script should work out which properties have been selected (using checkboxes) by the user and then add one to the Visits field of the selected property. I have created a text file where it will update and record the visit field of a property once it has been selected by the user.
code for available.form
<html>
<body>
<h3> Select the Property Price </h3>
<FORM ACTION="available.php" METHOD="POST">
</select>
Enter maximum price: <input type= "text" name= "maxprice" placeholder="Enter Amount" size="15"> <br>
<input type ="submit">
</form>
</body>
</html>
<html>
<body>
<FORM ACTION="available.php" METHOD="POST">
<?php
$searchPrice = $_POST['maxprice'];
$filename = "propertieslist.txt";
$filepointer = fopen($filename,"r"); // open for read
$myarray = file ($filename);
for ($mycount = 0; $mycount < count($myarray); $mycount++ )
{
// one input line at a time
$aline = $myarray[$mycount];
$postcode = &getvalue ($aline, 0);
$price = &getvalue($aline,1);
$house = &getvalue ($aline, 2);
$visit = &getvalue($aline,3);
if($searchPrice >= $price)
{
?><br><br> <input type = "checkbox" name = "aline"> <?
print "$postcode <br>";
print "$price <br>";
print "$house <br>";
print "$visit <br><br>";
}
fclose ($filepointer);
function getvalue ($text, $commaToLookFor)
{
$intoarray = explode(",",$text);
return $intoarray[ $commaToLookFor];
}
if (!($filepointer = fopen($filename,"r"))) { exit; }
?>
<input type= "button" name= "visit" value= "Visit"> <br>
</form>
</body>
</html>
Thats my code so far and im stuck on how to create the code when the user press the submit button. Thanks so much for the help!