dynamic table contents based off selection box from a database

S

SirPoonga

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.
 
M

Martin Honnen

SirPoonga said:
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.

Then use a HTML form
<form action="generateTable.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="frameName" ...>

</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.html>
in particular the section "Calling a server-side Script without
refreshing the page" on the last URL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top