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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:49:08+00:00 2026-05-23T00:49:08+00:00

how do i set a dropdown menu to a get variable after refresh. there

  • 0

how do i set a dropdown menu to a get variable after refresh. there is an html menu and after a refresh i would like the dropdown to be set to the select variable. for example if i select 3 from the menu then click submit the dropdown should display 3. i used to do this with textboxes where i would set the value to the get variable im just trying to do this same technique with html dropdown menus.

</select>
                <?php
                $c=$_GET['c'];
                $p=$_GET['p'];
                $id=$_GET['id'];



                if ($c!=NULL){


                        $sq=mysql_query("SELECT * FROM ps WHERE b='$id' AND c='$c'"); 


                            while ($row=mysql_fetch_assoc($sq)) { 


                            $start=$row['start'];
                            $start=trim($start);
                            $m=$row['m'];


                            }

                        echo "<select type='text' name='pro' id='amount' value= '$p'>";
                            echo "<option value=''>P</option>";
                                while ($start<=$m){

                                echo "<option value='$start'>$start</option>";

                                $start++;

                                }



                }
    ?>
                    </select>
  • 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-23T00:49:09+00:00Added an answer on May 23, 2026 at 12:49 am

    Is this in a form? If so you echo options like this:

       echo "<option value='$start'";
       if (isset($_POST['pro']) && ($_POST['pro']==$start)) echo " selected='selected'";
       echo ">$start</option>\n";
    

    But first you need to submit the form though.
    The idea is that you compare the value of a set variable for this select element to current value of $start within the loop, and print ‘selected’ if they match.

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

Sidebar

Related Questions

I have an unordered list set up for a hover/dropdown menu. I have the
I have a .change() function set for a dropdown menu with an ID of
I have a dropdown, I have a datasource, I have AutoPostBack set to true
We would like to block the deletion of documents in a list based on
I'm writing a customer form, where a drop down menu should be automatically set
I have a dropdown menu system setup such as this... This is the scripting
On this site: http://www.rent-turkey-property.com/ I have it set so that when you select a
I'm trying to create a dropdown that upon changing the selection from the list
I have a dropdown menu. When I click on Italian in the dropdown, I
There doesn't seem to be any tried and true set of best practices to

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.