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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:06:48+00:00 2026-05-15T06:06:48+00:00

I am trying to use php (and if not php, javascript) to link to

  • 0

I am trying to use php (and if not php, javascript) to link to a page and include a “?type=foo” or “#foo” at the end of the link so that when the linked page loads it will automatically select a specific option, depending on the end of the link, from a dropdown menu in a form. I have tried to search for this but do not know what this action is actually called, but I’ve seen it done before. Does anyone know how to achieve this? Thanks very much.

  • 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-15T06:06:48+00:00Added an answer on May 15, 2026 at 6:06 am

    When I have created these in the past, for ease of use, I have simply inserted the selected value in the top of the select object, rather than roll through the whole list and mark the selected one as such when it is encountered.

    Assuming the page is called like page.php?theSelectedList=Cougar:

    <select name="theSelectList">
      <?php
        if( isset( $_GET['theSelectList'] ) )
          echo '<option selected="selected">'.$_GET['theSelectList'].'</option>';
      ?>
      <option>Aardvark</option>
      <option>Baboon</option>
      <option>Cougar</option>
      <option>Dog</option>
      <option>Elephant</option>
    </select>
    

    In that case, the option for Cougar would be displayed twice – once at the top of the list, and selected, and again further down the list in the normal location. This may sound confusing, but, in the instances I have used it, it has been quite intuitive.

    It’s nice and simple, but, I will mention the caveat, that the above would need a bit of re-jigging if the Option Labels and the Option Values are different (like it each option has a numeric value, but a text label.

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

Sidebar

Related Questions

I'm trying to use php tag in a javascript function. But unfortunately its not
I am trying to use PHP preg_math parse a string that looks like: 6.15608128
What im trying to do, is use php include within a jquery append attribute.
Im trying to use PHP mail on my local computer, but its just not
I'm trying to pass PHP Function parameters using Javascript (not JQuery) AJAX. Do I
I've been trying to use SQLite with the PDO wrapper in PHP with mixed
On a php page with javascript (jquery) in the urel I would like to
When trying to use the code presented here link text I ran into some
I am trying to use the substring method inside JavaScript code which echoes some
I trying to use PHP's file upload abilities, but when I try to upload

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.