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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:47:25+00:00 2026-06-10T03:47:25+00:00

This question isn’t really about what’s wrong with some code. It’s about how to

  • 0

This question isn’t really about what’s wrong with some code. It’s about how to go about doing something. This is why no code is posted. Is there a way to run a specific MySQL query based on what’s selected in an HTML select box? Does a form have to be used here or is there another way?

I have now added the code and have tried using the switch statement way; however, the two textboxes are not being populated. Any ideas? The text in between the dashed lines isn’t really in the code but just a placeholder for the purpose of the question.

<?php
---db login info here---

switch($_GET['string'])
{
    case "another string":
       $query = mysql_query("SELECT field1 FROM table1 WHERE id = '1'");
       $row = mysql_fetch_row($query);
       break;
}

echo "<script type='text/javascript'>";
echo "document.getElementById('textbox').value = '$row[0]'";
echo "document.getElementById('textbox2').value = '$row[1]'";
echo "</script>";   
?>
  • 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-10T03:47:26+00:00Added an answer on June 10, 2026 at 3:47 am

    Yes, its possible. You can use forms or javascript URL call or ajax to perform this operation.

    What you need to do it, based on the value selected in the selectbox, you need to run the sql statement in a switch case or if conditions.
    The best option would be switch case for these kind of operations.

    Hope this helps.

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

Sidebar

Related Questions

I have an ASP.NET website, but this question isn't really about technology, it is
I'm doing some math with really big numbers (I'm using Python, but this question
Important: This question isn't actually really an ASP.NET question. Anyone who knows anything about
So this question isn't about integrating an existing payment gateway into my site. This
Im just messing around with Ruby on Rails and HTML. This question isn't about
This question isn't really for any specific technology but more of general developer question.
This question isn't about popping up an iframe inside a Lightbox; rather, it's about
The title of this question isn't so clear, but the code and question is
This question isn't about the technical usage of restricted, more about the subjective usage.
First this question isn't about trying to solve a specific problem. As newcomer 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.