php - how to compulsively send <input> data in a form in html file OR why I cannot send it -


here's thing: put <input type='checkbox' name='a'> in <form action="b.php" method="get"> can not '?a=something' url.
don't know what's wrong because use several <div>s nesting them , css style , bootstrap classes.

my complete code below.

<form action="addfile.php" name = "fileinfo_form" method="get">     <div class="input-group">         <span class="input-group-addon" id="basic-addon1">sha1</span>         <span class="input-group-addon">             <input type="checkbox" id ="sha1checkbox" name="sha1checkbox"><!--i cannot sha1checkbox's value url -->         </span>         <input type="text" name="sha1code" class="form-control" placeholder="sha1 hash code" aria-describedby="basic-addon1">     </div>     <input type="submit" class="btn btn-default" value="submit"></input> </form> 

your code seems working fine.

when checkbox checked, result in url addfile.php?sha1checkbox=on&sha1code=test.

if not checked, not return value in method via url checkbox. addfile.php?sha1code=test returned if use post can tell if checked or not in php code.

this normal behaviour of checkbox in html forms. don't worried.

you can insert following code in destination file test if checkbox checked or not.

<?php if(isset($_get['sha1checkbox'])){     echo "it set"; }else{     echo "it not"; } 

so not need worry appearing in url unless plan on using url in way.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -