forms - php what does checkbox default value 'on' -


recently while working checkbox, i've go through following test code:

<?php if ( isset( $_post['myname'] ) ) { $myvalue = $_post['myname']; echo $myvalue; } ?>  <form method="post"> <input type="checkbox" name="myname" /> <input type="submit" name="send" /></form> 

so, output got after form submission when checkbox checked prints 'on' else nothing (if value not provided on checkbox). , isn't supposed print 1(true) on checking checkbox. 'on' means in php?

if don't provide value attribute checkbox, it's value on

with

<input type="checkbox" name="myname" /> 

$_post['myname'] value on

with

<input type="checkbox" name="myname" value="1" /> 

$_post['myname'] value 1

in both cases when checkbox unchecked, doesn't present in $_post (not set)


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -