this is my code. this code will fetch somethings from my database. this not our matter. i have one or more than one check boxes. if in my while i have only one record there is no problem but when my records are more that one checkboxes no act.
here is the script of disable textfield via checkbox
<script language="JavaScript">
<!--
function enable_text(status)
{
status=!status;
document.f1.explain.disabled = status;
}
//-->
</script>
<?php
$id = $fgmembersite->UserID();
$db_host = 'localhost';
$db_name = 'site';
$db_table= 'action';
$db_user = 'root';
$db_pass = '';
$con = mysql_connect($db_host, $db_user, $db_pass) or die("خطا در اتصال به پايگاه داده");
$selected = mysql_select_db($db_name, $con) or die("خطا در انتخاب پايگاه داده");
mysql_query("SET CHARACTER SET utf8");
$dbresult = mysql_query("
SELECT tablesite.name,
tablesite.family,
tablesite.username,
tablesite.phone_number,
tablesite.email,
action.service_provider_comment,
action.price,
action.date,
job_list.job_name,
action.ind
FROM $db_table
INNER JOIN job_list ON job_list.job_id = action.job_id
INNER JOIN tablesite ON tablesite.id_user=action.service_provider_id AND action.customer_id='$id'
WHERE vote = ''", $con);
$i = 1;
while ($amch = mysql_fetch_assoc($dbresult)) {
echo "<form name=f1 id='form_$i' method='post' action='{$_SERVER['PHP_SELF']}' accept-charset='UTF-8'>
";
echo'<div dir="rtl">';
echo "نام خدمت دهنده: " . "   ".$amch["name"] . " " . $amch["family"] . "   " . "شماره تماس: " . $amch["phone_number"]. "   " . "ایمیل: " . $amch["email"] . '<br/>' .
"شغل انجام شده: ".$amch["job_name"] . '<br/>'
."تاریخ انجام عملیات: ".$amch["date"].'<br/>'
."هزینه ی کار: ".$amch["price"]." تومان".'<br/>'
.$amch["service_provider_comment"].'<hr/>';
echo'<label for="explain" style="color:#CC0000">این فیلد را فقط در صورتی پر کنید که شکایت دارید</label> <br />';
echo'<input type="checkbox" name=others onclick="enable_text(this.checked)" >شکایت دارم <br>'; //here is checkbox
echo'<textarea name="explain" id="explain" cols="" rows="" style="width:300 ;height:300"> //checkbox can disable or enable this field
</textarea>'.'<br/>';
echo '<input type="hidden" name="ind" value="' . $amch["ind"] . '">'; //new line
echo '<br/>';
echo '<input type="submit" name="submit" value="ارسال نظر شما"/>';echo'<hr/>';
echo'<hr/>';
echo'</div>';
echo "</form>
";
$i++;
}
?>