php - If form is submitted, then checkbox checked -
i want make if form submitted then checkbox should checked.
here have:
<input type="checkbox" id="chk" <?php if ($_post['submit']){ echo checked } ?> />
html:
<form id="form1" enctype="multipart/form-data" action="" method="post"> //stuff here <input name="submit" type="submit" value="upload" /> </form>
i getting blank page when test it... appreciated.
blank because there php error of php code , have turned error_reporting
off.
if($_post['submit'])
shouldif (isset($_post['submit']))
echo checked
shouldecho 'checked';
the sample below works me.
<form id="form1" enctype="multipart/form-data" action="" method="post"> //stuff here <input name="submit" type="submit" value="upload" /> </form> <input type="checkbox" id="chk" <?php if (isset($_post['submit'])){ echo 'checked'; } ?> />
Comments
Post a Comment