Hi
How do you find out if the checkbox has been checked?
this is my code:
<html><head> <title> checkbox </title> </head>
<body>
<FORM ACTION="comments.php" METHOD="POST">
Enter your comment <input type = "text" name = "username" value ="">
<p><input type ="submit" value="SUBMIT" name = "B1">
<input type = "reset" value="Reset" name = "SB2"
</form>
</html>
<?php
#reads a text file and outputs it to screen
if(!(isset($_POST['username']))) {exit;}
$uname = $_POST['username'];
print "The comments are: <br>";
$filename = "comments.txt";
$filepointer = fopen($filename, "r"); //open for read
$myarray = file ($filename);
for ($mycount = 0; $mycount < count($myarray); $mycount++)
{ //one line at a time
$aline = $myarray[$mycount];
$boxname = "box".$mycount;
$partdetails = getvalue($aline);
if ($_POST['username'] > $partdetails[2])
{
print "$partdetails[0]<INPUT TYPE='checkbox' NAME='$boxname' ><br>";
print "$partdetails[1]<br>";
print "$partdetails[2]<br>";
print "$partdetails[3]<br><br>";
$myvalue = "$mycount";
print "<INPUT TYPE = 'hidden' NAME='mysecret' VALUE='$myvalue'>";
}
}
fclose ($filepointer);
function getvalue ($text)
{
$intoarray = explode(",",$text);
return $intoarray;
}
// if (!($filepointer = fopen($filename,"r"))) { exit; }
?>