I have a GPA calculator form, and when a user enters their information, I want it to stay populated on the screen.
E-mail: <input type="text" size="35" name="email" value="<?php echo $email; ?>">
<span class="error"><?php echo $emailErr; ?></span>
<br><br>
<input type="checkbox" name="agree" >
I agree to the terms and conditions of this website.
<span class="error"><?php echo $agreeErr; ?></span>
<br><br>
I have no problem with my other variables, but I cannot get my checkbox to stay on the screen. When the user hits submit, the checkbox will un-check again. How can I make it stay checked on the screen?
Thank you!
$_POST['agree']maybe true. When you re-populate to the form, add attributecheck=<?= $_POST['agree'] ?>to the checkbox Btw, I dont think this question is relevant tocomputer-science