php - How can names in an echoed html tags be used -
i have code abc.php want create array of check boxes if try accessing name or id, doesn't seem work.is there alternative way this?
<html> <body> <form method="post"> <?php echo ""."<input type='checkbox' name='check[]' id='check[]' />" $c=0; if(isset($_post['check[$c]'])){ echo "checked"; } ?> </form> </body> </html>
you have $_post['check[$c]']
in single quotes, not replaced value of $c
. not mention multidimensional arrays not work way.
to check $_post variable treat array:
$checked = $_post['check']; // $checked[0] - first element // $checked[1] - second etc
Comments
Post a Comment