Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Shruti Bansal
capture
1 Answer(s)      3 years and 10 months ago
Posted in : HTML


How can i capture values or text selected in drop down menu or in combo box or in any input forms and print it on the same page ?? also the selected value i want to store it in data base. how can i do that??

plzzzz reply soon...!


Advertisement
View Answers

May 31, 2011 at 1:13 PM


1)selCombo.html:

<html>
<script>
function selValue(){
var mytext = document.form.sel.options[document.form.sel.selectedIndex].text;
document.getElementById('lab').style.visibility="visible";
document.getElementById('val').style.visibility="visible";
document.form.val.value=mytext;
}

</script>
<form name="form" method="post" action="http://localhost:8080/examples/jsp/save.jsp">
<select name="sel" id="sel" onchange="selValue();">

              <option value="<-Select->"><- Select- ></option>
              <option value="India">India</option>
              <option value="USA">USA</option>
              <option value="Srilanka">Srilanka</option>
              <option value="Japan">Japan</option>
              <option value="Australia">Australia</option>

            </select>
            <br><br>
            <label id="lab" name="lab" style="visibility:hidden;">You have selected:</label><input style="visibility:hidden;" id="val" type="text" name="val" ><br>

            <input type="submit" value="Save" >
</html>

2)save.jsp:

<%@page import="java.sql.*"%>
<%
try{
String str=request.getParameter("val");
Class.forName("com.mysql.jdbc.Driver").newInstance();  
 Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");  
Statement st=con.createStatement();
int i=st.executeUpdate("insert into country(countryname) values('"+str+"')");
out.println("Inserted Successfully!");
}
catch(Exception e){
    System.out.println(e);
}
%>


Related Tutorials/Questions & Answers:
capture
capture  How can i capture values or text selected in drop down menu or in combo box or in any input forms and print it on the same page ?? also the selected value i want to store it in data base. how can i do that?? plzzzz
webpage capture
webpage capture   webpage capture source code using jsps and servlets
Advertisements
Screen Capture
Screen Capture  How to capture the screen using jsps and servlets
How to capture screenshot in url?
How to capture screenshot in url?  Hi, How to capture screenshot and it will store the capture image in url like this http://localhost/xxx/yyy/ it wil not sore C:\ or D:\ it should store like this http://localhost/xxx/yyy
Capture a image and upload to server
Capture a image and upload to server  Hai team i have trouble to capture a image and upload to server in java me........... So i want a code immediately,.......To capture a image and upload to server in j2me...... If you give
php web page capture
php web page capture  How to capture the history of a web page using PHP
url capture in javaScript
url capture in javaScript  Hi All, I m creating a bookmark to capture the url of the site and the user's input in the bookmark,in javaScript.this url and user input is to be saved into DB. Following is my code.Result
can I capture wifi trafic in windows?
can I capture wifi trafic in windows?  Hi, can I analyse wifi trafic in windows and not in linux ? thank you
How to capture output from console into textarea in java?
How to capture output from console into textarea in java?  Hi, I would like to know how can we display the result of a program in java into a textarea instead of displaying it on console. Thanks
How to capture picture from webcam using java
How to capture picture from webcam using java  i want catch the image from web-cam using jsp, If anyone knows please answer me
How to capture video and then how to store it in mobile memory
How to capture video and then how to store it in mobile memory  Hello there, I'm developing a mobile application where i'm capturing video from... but they are not working properly some of them capture video but doesn't allow me
Capture browser file download event - JSP-Servlet
Capture browser file download event  Hi, I appreciate your help and thaanks for that.But my question was when filedownload dialog box comes in browser,how we can come to know that user has clicked on Open,save or cancel button
Data Capture from resume - JSP-Servlet
Data Capture from resume  Hi Sir, In My Application, when i Upload a resume the relevant columns like name,phone,email,skills etc need to be captured automatically and must be stored into the database. Please solve
how to capture jsf form data - Java Server Faces Questions
how to capture jsf form data  hi , i have a jsf page with username ,password and submitt button,if i submitt the data then it has to store in the database this is the task i have to do plese tell me the procedure how to do
how to capture IE browser FileDownload box open ,save and cancel event - JSP-Servlet
how to capture IE browser FileDownload box open ,save and cancel event  I have a JSP page which allows user to download a file.When user click... to capture open,save and cancel event of filedownload box in javascript. Please
Capturing Text in a Group in a Regular Expression
Capturing Text in a Group in a Regular Expression       This section illustrates you how to capture.... In this section, you will capture the text which is completely made by alphabet
Using the Captured Text of a Group within a Replacement Pattern
illustrates you how to capture the string or text through the regular expression... expression of the code which has been used to capture each and every word one by one
question
question  how to capture web snippets using java or java script
Caputuring screen shot
Caputuring screen shot  How to to capture screen shot for a computer on internet
Junit
Junit  How to capture junit error reports in to a file
Flex event
Flex event  hi...... How to capture and event if the component is disabled? please give an example..... Thanks in advance
Servlet Init method
Servlet Init method  can we capture the form data into the init method of the servlet
Java HTML scraping - Development process
Java HTML scraping   Is it possible to capture a page content from other website and include in our page dynamically
recorder screen in java
recorder screen in java  Dear friends, how can I capture the screen in real time? best regards Riccardo Susca
recorder screen in java
recorder screen in java  Dear friends, how can I capture the screen in real time? best regards Riccardo Susca
Networking in java - Java Server Faces Questions
Networking in java  I have project named screen capture & controlling..How to use multithreading to connect different clients with server & how to handle
iPhone Capturing Screen SDK
iPhone Capturing Screen SDK  Creating an application to capture the screen shots from iPhone. In objective c is there any class that make it enable..?   UIGraphicsBeginImageContext(CGSizeMake(480,320)); UIImage* result
java
java  Write a Java application that can capture five or more numbers and returns the total of the numbers, the average and the difference between total and average using input dialogs
CAMERA APPLICATION J@ME
CAMERA APPLICATION J@ME  i had written the code to capture image in j2me it is running well on emulator but not running on nokia 6303 if anyone knows please help me at maheshwari1986ashish@gmail.com
Advertisements
 

 

 

DMCA.com