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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:35:41+00:00 2026-06-15T14:35:41+00:00

I have a form with input type-select however when page submit and post back

  • 0

I have a form with input type-select
however when page submit and post back with error message
The select value is clean, I try to use radio button (checked unchecked) to retain the value,
yet it is not working.

//HTML///////////////////////////////////////////////////////////////////
<select name="age">
     <option value="">Age</option>
     <option value="14-17" <?PHP echo $age_14; ?>>14 - 17</option>
     <option value="18-29" <?PHP echo $age_18; ?>>18 - 29</option>
</select>

//PHP////////////////////////////////////////////////////////////////////
$age_14="unchecked";
$age_18="unchecked";

$age=$_POST['age'];
  if($age=='14-17'){$age_14="checked";}
  else if($age=='18-29'){$age_18="checked";}
  • 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-06-15T14:35:42+00:00Added an answer on June 15, 2026 at 2:35 pm

    With select tag you have to use selected="selected" not checked.

    Try with:

    $age_14 = "";
    $age_18 = "";
    
    $age = $_POST['age'];
    if ($age == '14-17') {
        $age_14 = 'selected="selected"';
    } elseif ($age == '18-29') { 
        $age_18 = 'selected="selected"';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a form like this: Name:<input type=text name=xxx id=name/> Type:<select> <option>xx</option> <option>xx</option>
I have a form with input type=file and another input type=submit . I hide
I have in my form an input element with type of file. What I
I have an ASP.NET Webform and inside the form I have an input type
I have an input form with two textareas allowing a user to type in
I have this form with a date input. echo $this->Form->create('Nodata'); echo $this->Form->input('date1', array('type' =>
I have form with multiple input type=radio with text next to them. I want
How do I calculate fields in a form with both input type and select
so I have a simple login page like this: <fieldset> <legend>Verification</legend> <form method=post action=authentication.php>
I currently have a form with a 'select' input in it. When the user

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.