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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:50:33+00:00 2026-05-26T15:50:33+00:00

I am not exactly how to do it and how to word the question,

  • 0

I am not exactly how to do it and how to word the question, so i shall try my best (PS: i’m new to web dev, so please be clear in your answers if you could).

So, I have got a drop down menu with the list names, which are taken from my database. In that database i have a table with names column (the ones that are rendered to the dropdown box) and relevant information to those names. Now, I want that relevant information to appear below in a tag when a user choose one of those names. I also cannot use the form.submit() method because my submit button is already taken for something else.

Here is the code to that bit:

<form name="name_choice" method="post" action="index.php">
     <select name="names" onchange="form.some_method()">
      <option value="NULL" selected="selected">--Select name--</option>
       <?php
            for ( $i = 0; $i < $numrows; $i++ ) { //for all the columns, iterate and print out                  
                        $id_names = mysql_result($result, $i);
            echo "<option value='".$id_names."'>".$id_names."</option>";
        }
        ?>
 </select>
 </form>

So the bit above works fine, but the “some_method()” is my problem, i don’t know what to trigger to display the text in the div below the drop down box (code is below for it):

<div class="information"> <!--if the name is chosen ONLY!-->
    <?php
    if($_POST['names'] == "NULL") {
         echo '<p>Please select an option from the select box.</p>'; //this bit is for testing
    }
    else {
         echo '<p>You have selected: <strong>', $_POST['names'], '</strong>.</p>';
                 //and then how to echo the relevant information?:(
    }                   
    ?>
</div><!--end of possible info-->
  • 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-26T15:50:34+00:00Added an answer on May 26, 2026 at 3:50 pm

    onchange is a JavaScript event. PHP can’t do realtime processing of form data, as it sits on the server and the form is on the client. You can sort of do it by using AJAX and passing the form data as the user types, but that would be a lot more work than is needed. Take a look at JavaScript form validation posts to get yourself headed on the correct path.

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

Sidebar

Related Questions

I'm not exactly sure how to word this question so I'll just use an
Note: Sorry this is not exactly a programming question; please migrate it if there
Not sure exactly how to word this question ... so edits are welcomed! Anyway
I'm not exactly sure how to word this question, so sorry in advance for
Im not sure how to exactly word my issue but I will try my
Note: I am not exactly sure what to name the question, so if someone
I'm not exactly new to PHP but I haven't used MySQL that much, so
The question title is a bit strange because I'm not exactly sure how to
sorry, it's not exactly a programming question, but I am currently in a research
I am facing a dilemma related to another question but not exactly the same.

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.