By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

dynamic table contents based off selection box from a database

P: n/a
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.

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


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

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.