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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:10:29+00:00 2026-06-04T00:10:29+00:00

echo <td>Language</td>; echo <td><select id=’language’ name=’language’> <option value=”>Select…</option> <option value=’en_US’>English(US)</option> <option value=’en_AU’>English(AU)</option> <option value=’en_US’>English(UK)</option>

  • 0
echo "<td>Language</td>";
echo "<td><select id='language' name='language'>
            <option value=''>Select...</option>
            <option value='en_US'>English(US)</option>
            <option value='en_AU'>English(AU)</option>
            <option value='en_US'>English(UK)</option>
          </select>
      </td>";   

I have that code snip enclosed in a form to post of a php file and when i choose to submit the form, I can see those options. However, after i click a button to save what I have selected, the language above is always set to the first option (en_US) no matter what ever.

  • 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-04T00:10:30+00:00Added an answer on June 4, 2026 at 12:10 am

    You’ll need to check your last submitted value to determine which option should receive the selected attribute. You’re currently not doing this, so the browser sets the first option as the selected one.

    // Define all languages
    $l = array('en_US'=>'English(US)','en_AU'=>'English(AU)','en_UK'=>'English(UK)');
    
    // Prepare an options variable
    $o = "";
    
    // Construct our options list
    foreach ( $l as $k => $v )
      $o .= sprintf("<option value='%s'%s>%s</option>", 
              $k, $k === $_POST["language"] ? " selected" : "", $v);
    
    // Echo our Select menu
    echo "<select id='language' name='language'>$o</select>";
    

    Demo: http://codepad.org/PkwNYHbO

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

Sidebar

Related Questions

I have this code that Show/Hide a text box if I select a category
I have a select all button on this page that works on other browsers
I have the following code that generates my form on my html page <input
I have to convert all my echo/print string from my php source code file
<?php $language = $_SERVER['HTTP_ACCEPT_LANGUAGE']; echo $language; ?> When I use Firefox to test this
@echo off for /f %%a in (httpd.conf) do ( echo %%a ) I have
so here is my code and I will tell you the problem after that:
This is my XML: <?xml version=1.0 encoding=ISO-8859-1?> <Translation language=en-US> <Field Name=SenderName>QueWay</Field> <Field Name=PasswordRecovery>Password Recovery</Field>
i have a form that consist of two textfield and one combobox. i want
I'd like to have a div on my web page that is based off

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.