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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -