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

  • Home
  • SEARCH
  • 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 9069989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:34:15+00:00 2026-06-16T17:34:15+00:00

I have an html form that I have been using to POST to a

  • 0

I have an html form that I have been using to POST to a php form, this saves the posted data into the database. I am now loading the data back into the form when I click edit, this works fine for the text fields as I can just use

value="<?php echo $somefield ?>" 

The problem is im not sure how to re select my dropdown menu. The menu looks like this and is used for selecting a category, but when the page reloads nothing happens and the dropdown isn’t reloaded.

    <select name="category" id="category">
    <option>- Select A Category -</option>
      <optgroup label="Tractors">
      <option value="Tractor">Tractor</option>
      <option value="Compact">Compact</option>
    <option value="Forklift">Forklift</option>
    <option value="Load All">Load All</option>
    <option value="Loader">Loader</option>
    <option value="Maniscopic">Maniscopic</option>
    <option value="Masted">Masted</option>
    <option value="Piviot">Piviot</option>
    <option value="Telescopic">Telescopic</option>
    <option value="UTV">UTV</option>
      </optgroup>
      <optgroup label="Machinery">
      <option value="Attachments">Attachments</option>
      <option value="Bale Handling">Bale Handling</option>
      <option value="Cultivation Equipment">Cultivation Equipment</option>
      <option value="Drills">Drills</option>
      <option value="Feeders">Feeders</option>
      <option value="Fertlizer Spreaders">Fertlizer Spreaders</option>
      <option value="Grass Harrows">Grass Harrows</option>
      <option value="Grassland Equipment">Grassland Equipment</option>
      <option value="Hedge Cutters">Hedge Cutters</option>
      <option value="Mowers">Mowers</option>
      <option value="Muck Spreaders ">Muck Spreaders </option>
      <option value="Ploughs">Ploughs</option>
      <option value="Post Hammers">Post Hammers</option>
      <option value="Power Harrows">Power Harrows</option>
      <option value="Rakes">Rakes</option>
      <option value="Rolls">Rolls</option>
      <option value="Rotovators">Rotovators</option>
      <option value="Shredders">Shredders</option>
      <option value="Splitters">Splitters</option>
      <option value="Sprayers">Sprayers</option>
      <option value="Spreaders">Spreaders</option>
      <option value="Tankers">Tankers</option>
      <option value="Tedders">Tedders</option>
      <option value="Toppers">Toppers</option>
      <option value="Trailers">Trailers</option>
      <option value="Wrappers">Wrappers</option>

      </optgroup>
      <optgroup label="Forklifts">
      </optgroup>
    </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-06-16T17:34:16+00:00Added an answer on June 16, 2026 at 5:34 pm
    <?php
    
      echo '<select>';
      foreach( $names as $name )
        echo '<option value="'.$name.'" '.($name==$selected?' selected="selected"':'').'>'.$name.'</option>'
    
      echo '</select>';
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML form that sends 索索索 using post to my PHP file.
I have an html/php form that updates entries on the database server. I need
So I have been asked to insert rows to this database using a html
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have a simple html form that looks like the following <form action=search.php method=get>
I have a simple html form that is structured something like this: <form name=test
I have a js and html form that submits through php. Once submitted, the
I have a file, index2.php that has been written to by a form. The
I had a PHP processing script for an HTML form that had been working
I have a following problem, I have HTML form that uploads a file with

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.