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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:38:18+00:00 2026-05-28T05:38:18+00:00

I have an HTML table which is poulated by a user. The first colum

  • 0

I have an HTML table which is poulated by a user. The first colum in the row has a drop down box where they select an option generated by a mysql database.

This is for an orders table and the order could consist of 1 row to 72 rows. When the form loads, I only want 1 row to be displayed. When the select an option on the first row, the second row must appear. when an option is selected from the 2nd row, the 3rd row appears. and all the way to the end where row 72 only appears if an option is selected from row 71.

I hope this makes sense.

Below is my HTML table ( for 5 rows only)

<table>
<tr>
    <td>
        <select name="users" onchange="showUser(1, this.value)" size=1> 
        <OPTION VALUE=0>
        <?=$optionssku?> 
        </SELECT> 
    </td>
    <td>
        <div id="txtHint1"><b>SKU Details will be seen here</b></div>
    </td>
</tr>

<tr>
    <td>
        <select name="users" onchange="showUser(2, this.value)" size=1> 
        <OPTION VALUE=0>
        <?=$optionssku?> 
        </SELECT> 
    </td>
    <td>
        <div id="txtHint2"><b>SKU Details will be seen here</b></div>
    </td>
</tr>

<tr>
    <td>
        <select name="users" onchange="showUser(3, this.value)" size=1> 
        <OPTION VALUE=0>
        <?=$optionssku?> 
        </SELECT> 
    </td>
    <td>
        <div id="txtHint3"><b>SKU Details will be seen here</b></div>
    </td>
</tr>

<tr>
    <td>
        <select name="users" onchange="showUser(4, this.value)" size=1> 
        <OPTION VALUE=0>
        <?=$optionssku?> 
        </SELECT> 
    </td>
    <td>
        <div id="txtHint4"><b>SKU Details will be seen here</b></div>
    </td>
</tr>

<tr>
    <td>
        <select name="users" onchange="showUser(5, this.value)" size=1> 
        <OPTION VALUE=0>
        <?=$optionssku?> 
        </SELECT> 
    </td>
    <td>
        <div id="txtHint5"><b>SKU Details will be seen here</b></div>
    </td>
</tr>

</table>

I know this is not a coding forum but I have searched the net for a while for a relevant example and found nothing. my javascript knowledge is very verly limited, if someone could point me in the right direction it would be greatly appreciated.

Thanks and regards,
Ryan Smith

Update 17 Jan 2012.

Below please find a simplified script which I cannot get to work correctly.

<html>
 <head>

<script type="text/javascript"> 
  function showUser(userNumber, str) 
    {
    document.getElementById("r"+index).style.display="block" 
    }
</script> 

 </head>
 <body>


<table> 
<tr id="r1"> 
<td><select name="users" onchange="showUser(1, this.value)">  
        <OPTION VALUE=1> 
        1 
        </option> 
        <OPTION VALUE=2> 
        2
        </option>
        <OPTION VALUE=3> 
        3 
        </option> 
        </SELECT> 
</td> 
</tr> 
<tr id="r2" style="display:none;"> 
<td><select name="users" onchange="showUser(2, this.value)">  
        <OPTION VALUE=1> 
        1 
        </option> 
        <OPTION VALUE=2> 
        2
        </option>
        <OPTION VALUE=3> 
        3 
        </option> 
        </SELECT> 
</td> 
</tr> 
</tr> 
<tr id="r3" style="display:none;"> 
<td><select name="users" onchange="showUser(3, this.value)">  
        <OPTION VALUE=1> 
        1 
        </option> 
        <OPTION VALUE=2> 
        2
        </option>
        <OPTION VALUE=3> 
        3 
        </option> 
        </SELECT> 
</td> 
</tr> 
</table> 

</body>
 </html>

The javascript function does not appear to be getting called correctly with the on change event.

Thanks and Regards,

Ryan Smith

  • 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-28T05:38:19+00:00Added an answer on May 28, 2026 at 5:38 am

    Set the ids for the rows in a sequential order and then set display property of the every row to display:none, except the first one and in the showUser method called on the each row while performing the selection, set the display for the subsequent row to display:block. You will get it working.

    For example:

    <table>
    <tr id="r1">
    <td><select name="users" onchange="showUser(2, this.value)" size=1> 
            <OPTION VALUE=0>
            <?=$optionssku?> </option>
            </SELECT>
    </td>
    </tr>
    <tr id="r2" style="display:none;">
    <td><select name="users" onchange="showUser(3, this.value)" size=1> 
            <OPTION VALUE=0>
            <?=$optionssku?> </option>
            </SELECT>
    </td>
    </tr>
    </table>
    function showUser(index,val)
    {
     document.getElementById("r"+index).style.display="block"
    //your code
    }
    

    Edit Part

    Ok I am guessing what you want just change the size=1 to size=2 in the tag. You will get the values within the dropdown list box itself.

    Edit on Jan17
    Hey change your function as shown below

    <script type="text/javascript"> 
      function showUser(userNumber, str) 
        {
        document.getElementById("r"+(userNumber+1)).style.display="block" 
        }
    </script>
    

    Hope this helps you.

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

Sidebar

Related Questions

I have an HTML table which has an onClick property on the row which
I have an HTML table where each row has buttons which toggle status bits
I have an HTML table which has incrementing numbers starting from 0 in its
I have an HTML table which has equally divided rows and columns. I would
I have an html table which contains records, comes from mysql db. Each row
I have an HTML table in which the first column's cells each contain a
I have 2 dropdowns on my HTML page : The first drop down contains
I have HTML table in which user make GRUD operations. But everyone knows that
I have got a HTML table which contain a check box in <TH> and
I have an html table, which includes let's say 1 row and 5 cells

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.