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 4119116
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:02:57+00:00 2026-05-20T23:02:57+00:00

I forgot to say there are drop down menus also that I would like

  • 0

I forgot to say there are drop down menus also that I would like to keep the chosen value of

I have a form with checkboxes, a radio buttons, and a few text fields. I know how to keep the text field values after form submit, but I would like to keep the radio button selection and checkboxes checked after submit. I am posting to the same page.

  • 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-20T23:02:58+00:00Added an answer on May 20, 2026 at 11:02 pm

    To have the radio buttons and checkboxes pre-checked, you need to add the checked="checked" attribute to the HTML you generate for each control you want to display checked.

    For example, if you currently have this:

    <input type="checkbox" name="foo" value="bar" />
    

    You want to change it to this:

    <input type="checkbox" name="foo" value="bar"
        <?php echo empty($_POST['foo']) ? '' : ' checked="checked" '; ?>
    />
    

    Update: For drop down menus, you want to change this:

    <select name="foo">
      <option value="bar">Text</option>
    </select>
    

    To this, which uses selected="selected":

    <select name="foo">
      <option value="bar" 
        <?php if(isset($_POST['foo']) && $_POST['foo'] == 'bar') 
              echo ' selected="selected"';
        ?>
      >Text</option>
    </select>
    

    Be careful to keep the two “bar” values that appear above synchronized (echoing the options in a loop will help to make sure of that).

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

Sidebar

Related Questions

I have a button that on click I would like to be disabled and
Let's say I have a Perl file in which there are parts I need
Say I have a table that includes column A, column B and column C.
Let's say I have an ASP.NET MVC webapp that calls a repository layer, which
Let's say I have some numbers, like 5,10,7,8,9,6,2,4,8,5,3,9,78,5,6 I need to send this to
I forgot how to do that and I am stuck. I have a site
Let's say that I have a named branch 'B1' which I'm doing feature development
Say you have select '9|2|6|7|5' as somedata from dual Is there a way where
Let's say that we have a DIV x on the page and we want
I have a formula in c that looks like this: X = (a *

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.