Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:07:22+00:00 2026-05-30T17:07:22+00:00

I know how to keep the checkboxes checked on form submit when there is

  • 0

I know how to keep the checkboxes checked on form submit when there is an error, but I have a different issue now. I am using check boxes of the same name where people can click 1 or multiple. I want it to only keep the check boxes that the user checked filled if there is a problem like if they check q1 A q1B but not q1c I want only q1 A and Q1b to show checked when reloaded on an error. Right now on an error all checkboxes of the same name are checked. I have tried changing the name to q1[] but that did not work. Can you please take a look and let me know how to fix this?

Here is my code.

    <tr>
<td style="width: 124px" class="style15">Tape Recorder<?php    if(isset($problems['tape[]'])) {?><font color="red">*</font><?php } ?></td>
<td class="style9"> 
    <input name="tape[]" id="tape1" type="checkbox" value="used before," <?php   if(isset($_POST['tape[]'])) echo "checked"; ?> 
  </td>
<td class="style9"> 
    <input name="tape[]" id="tape2" type="checkbox" value="helpful in past,"        <?php   if(isset($_POST['tape[]'])) echo "checked"; ?> </td>
<td class="style9"> 
    <input name="tape[]" id="tape3" type="checkbox" value="requesting from DACC" <?php if(isset($_POST['tape[]'])) echo "checked"; ?> </td>
<td class="style9"> 
    <input name="tape[]"  id="tape4" type="checkbox" value="NA" <?php if(isset($_POST['tape[]'])) echo "checked"; ?></td>
 </tr>
  <tr>
        <td style="width: 124px">Note Taker <?php if(isset($problems['note'])) {?>      <font color="red">*</font><?php } ?></td>
<td class="style9"> 
        <input name="note" type="checkbox" value="used before," <?php if(isset($_POST['note'])) echo "checked"; ?> 
</td>
<td class="style9"> 
    <input name="note" type="checkbox" value= "been helpful in the past," <?php if(isset($_POST['note'])) echo "checked"; ?> 
<td class="style9"> 
    <input name="note" type="checkbox" value= "requesting from DACC" <?php if(isset($_POST['note'])) echo "checked"; ?> 
<td class="style9"> 
    <input name="note" type="checkbox" value="NA" <?php if(isset($_POST['note'])) echo "checked"; ?> 
</tr>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:07:23+00:00Added an answer on May 30, 2026 at 5:07 pm

    A quick and dirty solution would be:

    <input name="tape[]"  id="tape[]" type="checkbox" value="NA" <?php if(isset($_POST['tape']) && is_array($_POST['tape']) && in_array('NA', $_POST['tape'])) echo 'checked="checked"'; ?> />
    

    For that you need to change the ‘NA’ part for each different answer obviously. Though I would look at something like having a loop for repeated checkboxes or a callback function to determine whether or not to echo checked=checked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there are quite a few different topics out there but I
I am interested to know what strategies people have to keep their code AND
I keep getting a PermGen error on my Tomcat 6 server. I know what
I would like to know if there is a way to keep the session
Does anyone know how to make an uneditable checkbox ina QTreeWidgetItem but keep the
We have an edit form:we populate it with a variable number of checkboxes (it
Alright I know that the .closest() have been discussed before, but I have been
I have a form where users can submit sites and say if they work
So I don't know why I keep getting this error. Here's the relevant code:
I know how to keep track of the checkbox in a datarow, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.