dynamic table contents based off selection box from a database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SirPoonga

    #1

    dynamic table contents based off selection box from a database

    What I'd like to do is have a dropdown box populated with data from a
    database. Based on what you select from the drop down a table will be
    generated (in this case a 3 column table) from another query to the
    database. I will eventually want a way to select one of the rows from
    the table, but for now I'd be happy with just generating the table.

    I know it will have to deal with DHTML, dom documents, getElementID,
    removeNode, recreating the node. What I am not sure about is how to
    1) Dynamically create a table
    2) Step 1 with data from a database (recordset)

    Like I said, I'd also like to be able to select a row from the table.
    I'd be happy with making the ros a radio group, though it would be
    interesting to be able to select the row. I take it I'd use CSS to
    highlight the row selected then.

  • Martin Honnen

    #2
    Re: dynamic table contents based off selection box from a database



    SirPoonga wrote:
    [color=blue]
    > What I'd like to do is have a dropdown box populated with data from a
    > database. Based on what you select from the drop down a table will be
    > generated (in this case a 3 column table) from another query to the
    > database.[/color]

    Then use a HTML form
    <form action="generat eTable.php">
    <select name="whatever" >
    <option>...</option>
    <option>...</option>
    </select>
    <input type="submit">
    </form>
    all that data base stuff has to happen on the server (with the server
    side language of your choice).
    If you want the select to automatically submit:
    <select onchange="this. form.submit();" ...>
    If you want the current page to stay then submit to another window/frame
    e.g.
    <form target="frameNa me" ...>

    </form>
    <iframe name="frameName " width="100%" height="200"></iframe>

    Client-side scripting can't help much unless you want to make the frame
    hidden and copy things over.
    Or you could consider using XMLHttpRequest form the browsers which
    support it:
    <http://www.faqts.com/knowledge_base/view.phtml/aid/17226/fid/616>
    <http://jibbering.com/2002/4/httprequest.htm l>
    in particular the section "Calling a server-side Script without
    refreshing the page" on the last URL.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    Working...