html - PHP How to pass checkbox states after POST -


i have quick question seem having trouble locating answer. (possibly wording) here goes.

  • i able echo post data form text/number variables without hitch! running in brick wall on these checkbox values.
  • i know if post checkbox post value of "on" lets on form if checkbox1 checked, how make corresponding checkbox on post page load checked?
  • i know in html have write "checked" within code tried using if statement job done couldn't seem working.

any appreciated!

thanks!

html:

<input type='checkbox' name='selected' value='1'> 

php:

$selected = isset($_post['selected']) && $_post['selected']  ? "1" : "0"; 

this code set selected checkbox value 1 in variable $selected , 0 if not selected.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -