The Artima Developer Community
Sponsored Link

Java Answers Forum
how to insert selected dropdown list value in mysql

3 replies on 1 page. Most recent reply: Aug 21, 2009 1:08 AM by Kondwani Mkandawire

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
agilan cstud

Posts: 2
Nickname: agilan
Registered: Jul, 2009

how to insert selected dropdown list value in mysql Posted: Jul 4, 2009 3:46 PM
Reply to this message Reply
Advertisement
Hi all,
Can any one help me to insert the dropdownlist selected value in mysql database.
i have a html like this....

<html>
<head>
<title>Bandwidth Allocation</title>
</head>
<table>
<tr>
<td width="50" height="2"><font color="#FFFFFF">Bandwidth Limit</font></td>
<td width="135" height="2"><input type = text size="17">&nbsp;&nbsp;</td>
<td width="50" height="2"><font color="#FFFFFF">User Group</font></td>
<td width="135" height="2">
<select><option value="Office User Group">Office User Group</option><option value="Home User">Home User</option><option value="Limited Plan User">Limited Plan User</option><option value="Unlimited Plan User">Unlimited Plan User</option></select>&nbsp;&nbsp;</td>
<td width="50" height="2"><font color="#FFFFFF">Upload Bandwidth</font></td>
<td width="135" height="2"><input type = text size="17">&nbsp;&nbsp;</td>
<td width="50" height="2"><font color="#FFFFFF">Download Bandwidth</font></td>
<td width="135" height="2"><input type = text size="17"></td></tr></table>
<center><table width="206"><tr><td width="137" height="2"><font color="#FFFFFF">Bandwidth Bustable</font></td>
<td width="135" height="2"><select><option value="Yes">Yes</option><option value="No">No</option></select></td></tr>
<br/> ;
</table></center>
</body>
</html>

I need to insert the values of the dropdown along with other fields in a table named bandwidth in mysql database.
Plz.. ur help needed urgently. Thanks in advance...


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: how to insert selected dropdown list value in mysql Posted: Jul 6, 2009 10:27 PM
Reply to this message Reply
I'm confused, it looks like you are using straight HTML? Is HTML not purely display? Is there a way to hit Server-side with HTML?

I think you need to learn a Webframework. JSP, JSF or something like that. PHP is quick and dirty to. I'd go for wicket though - if you're looking to go Java.

If there is a way to hit Server-side with straight HTML, my apologies (I suppose you would then want to look for an HTML forum).

litu sahoo

Posts: 2
Nickname: litucet08
Registered: Aug, 2009

Re: how to insert selected dropdown list value in mysql Posted: Aug 20, 2009 5:35 AM
Reply to this message Reply
hi
i think this can help u
First try to store the result set values in a arraylist.
then in jsp retrieve all the value one by one like this:


<tr>

<td><label class="fieldlabel1">Track Id:</label></td>
<td><label class="fieldlabelLoginErrorMsg">*</label></td>
<td><select name="crtrack" id="crtrack"
class="SelectStyle" onchange="javascript:fnapplication()">
<%
ArrayList arrTrack = new ArrayList();;
arrTrack = (ArrayList) session.getAttribute("ARRTRACKID");

for (int x = 0; x < arrTrack.size(); x++) {

String strTrCode = ((SelectionCollectionKeyString) arrTrack
.get(x)).getStrCode();

String strTrValue = ((SelectionCollectionKeyString) arrTrack
.get(x)).getStrValue();

%>
<option value=<%=strTrCode%>><%=strTrValue%></option>
<%
}
%>
</select></td>
</tr>


All teh best!

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: how to insert selected dropdown list value in mysql Posted: Aug 21, 2009 1:08 AM
Reply to this message Reply
> hi
> i think this can help u
> First try to store the result set values in a arraylist.
> then in jsp retrieve all the value one by one like this:
>
>
> <tr>
>
> <td><label class="fieldlabel1">Track Id:</label></td>
> <td><label
> abel class="fieldlabelLoginErrorMsg">*</label></td>
> <td><select name="crtrack" id="crtrack"
> class="SelectStyle"
> le" onchange="javascript:fnapplication()">
> <%
> ArrayList arrTrack = new ArrayList();;
> arrTrack = (ArrayList)
> ist) session.getAttribute("ARRTRACKID");
>
> for (int x = 0; x < arrTrack.size(); x++) {
>
> String strTrCode = ((SelectionCollectionKeyString)
> ring) arrTrack
> .get(x)).getStrCode();
>
> String strTrValue = ((SelectionCollectionKeyString)
> ring) arrTrack
> .get(x)).getStrValue();
>
> %>
> <option value=<%=strTrCode%>><%=strTrValue%></option>
> <%
> }
> %>
> </select></td>
> </tr>
>
>
> All teh best!

Assuming he is using JSP?

He posted HTML code and asked for assistance, personally I wouldn't use JSPs they are extremely tedios. Secondly, I'd do all looping etc, Server-side (from Java) rather than client-side (JSP).

Flat View: This topic has 3 replies on 1 page
Topic: Printer Access Previous Topic   Next Topic Topic: Audio streams

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use