html - Can't get value checkbox checked form php -
my checkbox not value after sending form ...
my form
<input name="username" type="text" autocomplete="off" id="username" /> <input type="checkbox" id="atur_peg" name="atur_peg" value="ya" checked />
my php
<?php echo $username=$_post['username']; // can value echo $atur_peg=$_post['atur_peg']; // , can't value ?>
this full form
<form class="cmxform" id="tambahuser" name="kepuasan_user" method="post" action="user/tambahuserproses.php"> <label>username</label> : <input name="username" type="text" autocomplete="off" id="username" size="40" maxlength="50" /> <span id="pesan"></span> <br /> <label>password</label> : <input name="password" type="password" autocomplete="off" id="password" class="showpassword" size="40" maxlength="50" /> <p> <label><strong>atur untuk pegawai ?</strong></label><input type="checkbox" id="atur_peg" name="atur_peg" value="ya" checked />ya </p> </form>
how correct ?
if checkbox checked value in $_post.
<form method="post" action=""> <input name="username" type="text" autocomplete="off" id="username" /> <input type="checkbox" id="atur_peg" name="atur_peg" value="ya" /> <input type="submit" name="submit" value="submit"> </form> <?php if (isset($_post['atur_peg'])) { $checkboxvalue = "yes"; } else { $checkboxvalue = "no"; } echo $checkboxvalue; ?>
Comments
Post a Comment