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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:10:39+00:00 2026-06-10T18:10:39+00:00

Hello I have a Query running on a page right now. Ultimately I need

  • 0

Hello I have a Query running on a page right now.

Ultimately I need the Country Code(Variable) to be selectable via Drop down menu so the query runs with with the selected Country Code(Variable.)

I would also like the Country Code to remain selected even if I go to another page so the query automatically runs with the preselected variable.

Thanks

  • 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-10T18:10:41+00:00Added an answer on June 10, 2026 at 6:10 pm

    Your form should read something similar to:

    <form name="country_list" method="POST" action="http://examplewebsite.com/script.php" target="_blank">
            Country:     <select name="Country" tabindex="1">
                         <optgroup label="Continent">
                            <option value="Country 1">Country 1</option>
                            <option value="Country 2">Country 2</option>
                            <option value="Country 3">Country 3</option>
                         </optgroup>
                    </select>
            <input type="submit" value="Filter" />
        </form>
    

    To input the selected country you would need to use $_POST[]

    <?php
    $selected = $_POST['Country'];
    ?>
    

    A long winded, but fairly simple approach to ensuring the selected country remains selected would be to each option as:

    <option value="Country 1" <? if($selected == 'Country 1'){ echo 'selected="selected"';} ?> >Country 1</option>
    <option value="Country 2" <? if($selected == 'Country 2'){ echo 'selected="selected"'; ?> }>Country 2</option>
    

    I realise for individual countries this could take a long while, but it should work – your problem is needing the ‘selected=”selected”‘ expression within the opening tag of each option on the list.

    This would only work if you reloaded the page from within the script – for example if you were error-checking the whole form and wanted to preserve the submitted results. If you are transitting to an entirely different page then a cookie would be one way to store the data, there are security issues and legal issues, especially in Europe, governing the use of cookies, however.

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

Sidebar

Related Questions

hello I have my code that connects to my ftp server $conn_id = ftp_connect($ftp_server);
Hello I have this code class Triplets { public: int nVal1; int nVal2; NodeT
Hello I have the following code: if(_deviceSegmentCntrl.selectedSegmentIndex == 0) { deviceOne = [[NSString alloc]
Hello I know all about http://www.php.net/manual/en/function.http-build-query.php to do this however I have a little
Hello I have the following php code here: $username = trim(mysql_real_escape_string($username)); $password = md5(trim(mysql_real_escape_string($password)));
Hello I have the code below that for some reason is not working: I
Hello Friends i have the following query which defeat the very purpose. A day
Hello: I have function like this one function query($query) { if (in_array($query,$this->queries)) { return
Hello I have this query : SELECT DISTINCT a.id, a.runcd, (SELECT SUM(b.CALVAL) FROM GRS
Hello I have a dynamic query like SET @template = 'SELECT x AS X,...

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.