dynamic multiplecheckbox values insertion

dynamic multiplecheckbox values insertion

hi

How to insert dynamically generated checkbox values to store in mysql data base using jsp?
View Answers

June 11, 2010 at 1:41 PM

Hi Friend,

Try the following code:

1)checkbox.jsp:

<html>
<form method="post" action="checkinsert.jsp">
<table>
<tr><td>Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>Gender</td><td><input type="radio" value="Male" name="gen">M <input type="radio" value="Female" name="gen">F</td></tr>
<tr><td>Languages</td><td><input type="checkbox" name="lang" value="Hindi">Hindi<input type="checkbox" name="lang" value="English">English<input type="checkbox" name="lang" value="French">French<input type="checkbox" name="lang" value="German">German</td></tr>
<tr><td><input type="Submit" value="Submit"></td></tr>
</form>
</html>

2)checkinsert.jsp:

<%@page import="java.sql.*"%>
<%
String name=request.getParameter("name");
String gender=request.getParameter("gen");
String checkValues[]=request.getParameterValues("lang");

try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register";, "root", "root");
String value="";
for(int i=0;i<checkValues.length;i++){
value+=checkValues[i]+" ";
}
Statement stmt = con.createStatement();
int j=stmt.executeUpdate("insert into person1(name,gender,languages) values('"+name+"','"+gender+"','"+value+"')");
out.println("inserted succesfully");
}
catch(Exception e){}
%>

Thanks









Related Tutorials/Questions & Answers:
dynamic multiplecheckbox values insertion - JSP-Servlet
dynamic multiplecheckbox values insertion  hi How to insert dynamically generated checkbox values to store in mysql data base using jsp?  Hi Friend, Try the following code: 1)checkbox.jsp: Name
dynamic delete and insertion in tables
dynamic delete and insertion in tables  hey... i have a problem..I am working on a problem management system..my code for a particular jsp page is as follows in this page i want to show the admin the already present records
Advertisements
dynamic delete and insertion in tables
dynamic delete and insertion in tables  hey... i have a problem..I am working on a problem management system..my code for a particular jsp page is as follows in this page i want to show the admin the already present records
how to store a dynamic values - JSP-Servlet
how to store a dynamic values  Dear sir, i have a ArrayList in that i have stored a values from a excel sheet specified column values and i... and bonus is ~5 . Thanks Hr in another arraylist i have a values ~2,~3
do not repeat values in databse during insertion using php and javascript
do not repeat values in databse during insertion using php and javascript ... sql.php and form.jsp. i want to do insert values into mssql database from user input form. sql.php is able to insert the values into database. i have connected
How to insert dynamic textbox values into database using Java?
How to insert dynamic textbox values into database using Java?  Hi I am trying to insert dynamic textbox values to database, my jsp form have 2... these dynamic textbox values to database(Oracle 11g)...Please help me out. I have
Insertion Sort In Java
In this example we are going to sort integer values of an array using insertion sort... .Insertion sort is a good choice for small values and for nearly-sorted values... for large values . Positive feature of insertion sorting: 
Insertion into database
Insertion into database  Hi, I need code for inserting the multiple select box values into database.Please do send me the code. Thanks for ur immediate replies its helping a lot
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  how many arrays needed for insertion sort and why
Insertion Sort Java
Insertion Sort in Java is an algorithm that is used to sort integer values...(); insertion_Sort(array, array.length); System.out.print("After Values..., Insertion Sort in Java is less efficient when it comes to larger data sets
Calendar window is not showing the textbox values for the Dynamic rows in html page - Java Interview Questions
Calendar window is not showing the textbox values for the Dynamic rows in html page  My code is here now.When i click on calendar ,value.../Remove dynamic rows in HTML table window.history.forward(1
insertion in SQL - SQL
insertion in SQL  Hi! Everybody... i have a problem with sql insertion. When i am inserting values through command i.e. insert into employee values(,,,,); here i want to insert ' in employee name column of database
Insertion Sort Applet
Insertion Sort Applet  Please All , I need Insertion sort applet program
Insertion Sort Applet
Insertion Sort Applet  I need Insertion Sort Applet code was design by Dr. Daniel Liang Please
insertion sort applet code
insertion sort applet code  i need Insertion Sort Applet Program
Insertion Sort Timer
Insertion Sort Timer  Welcome all I wanna program in java find the timer of insertion sort and find time complexity for random value thanks all
insertion error - JSP-Servlet
insertion error  my first jsp page : In this i m getting all the values through a method called getAllDetails,the values are getting inserted... the values are getting inserted that is null values are getting inserted before
File insertion into oracle database
File insertion into oracle database  How to Read and Insert a file (any format) into a Oracle database
hibernate insertion problem - Hibernate
hibernate insertion problem  Hi , Thanks for the material .Its very gud . when i run FirstExample.java i get the message insertion has been done int the table contact . but whne i look into database data is not inserted
insertion in SQL - SQL
insertion in SQL  Query is "insert into employee values('"+eno+"','"+ename+"');" in the ename place we will get employee names such as John's... = "INSERT employee (username)VALUES('"+str+"')"; System.out.println(sql + sql
Java insertion sort question
Java insertion sort question  I've got another program that I need help with. I am trying to write a Java method that accepts an array of strings, and sorts the strings using the insertion sort algorithm. Then I need to write
Binary search tree (insertion) urgent!!
Binary search tree (insertion) urgent!!  Create a program... in Java.Avoid duplication of values when inserting nodes in the tree. When a new leaf.... Assume a binary search tree is constructed from the values 14, 35, 2, 3, 39
Insertion Sort Problem
Insertion Sort Problem  So I have this in a class file. It is supposed to be an insertion sorter: int min, index=0, temp; for(int i=0;i<sorted.length;i++){ min=sorted[i]; for(int j=i+1;j<
DYNAMIC BINDING
DYNAMIC BINDING  WHAT IS DYNAMIC BINDING
Insertion Sort - Java Beginners
Insertion Sort  Hello rose india java experts.If you don't mind.Can you help me.What is the code for Insertion Sort and Selection Sort that displays LETTERS in alphabetical order from A to Z. Thank you.Hope you gonna helpme
data insertion and fetch 1
data insertion and fetch 1  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html>...,choice) VALUES('"+Id+"','"+Name+"','"+Home+"','"+Location+"','"+Gender
javascript variable value insertion in DB
javascript variable value insertion in DB  how can I insert javascript variable value into database using php
Insertion of multiple row data for billing purpose.
Insertion of multiple row data for billing purpose.  Hi , I have a hrml page . with 4 input text field as a 4 column and 4-5 rows... is that the no of text field in row/column can be dynamic. so how can i insert all
dynamic report
dynamic report  i need complete code for generating dynamic report in jsp
PHP SQL Insertion
) values('komal',12)"; echo "Insertion Successful ..."... PHP SQL Insertion       PHP SQL Insertion is used to execute MySQL queries in PHP script
Inserting content(DOM Insertion)
Inserting content(DOM Insertion)       Inserting content(DOM Insertion) Inserting... : DOM insertion DOM insertion, Around DOM
dynamic polymorphism
dynamic polymorphism  Develop with suitable hierarchy, classes for Point, Shape, Rectangle, Square, Circle, Ellipse, Triangle, Polygon, etc. Design a simple test application to demonstrate dynamic polymorphism
ModuleNotFoundError: No module named 'readgroup_platform_insertion'
ModuleNotFoundError: No module named 'readgroup_platform_insertion'  ...: No module named 'readgroup_platform_insertion' How to remove the ModuleNotFoundError: No module named 'readgroup_platform_insertion' error
Dynamic keyword
Dynamic keyword  hi....... What is the dynamic keyword used for in flex? give me the answer ASAP Thanks  Ans: Dynamic keyword-> Specifies that instances of a class may possess dynamic properties added
dynamic jquery statement
dynamic jquery statement  dynamic jquery statement
Issue with tutorial realted to insertion in middle in Linked List
Issue with tutorial realted to insertion in middle in Linked List  insert in middle in Linked list will take O(N) instead as displayed as O(1
dynamic polymorphism
dynamic polymorphism  give an example for dynamic polymorphism?   Dynamic polymorphism is where a class overrides a superclass method... seen at runtime, so they are considered dynamic. Here is an example
data insertion from xml file to database table
data insertion from xml file to database table  Hi all, I have data in the XML file. I need to insert it into table in the database using servlet. so please reply me . ThankYou
writing querries qnd connecting for insertion, accessing....
writing querries qnd connecting for insertion, accessing....  i created my front ends using html, and my back end using oracle 10g, i dont know how...,address) values('"+name+"','"+address+"')"); out.println("Data
PHP Dynamic CheckBox
PHP Dynamic CheckBox  Help with Dynamic Checkbox in PHP
php dynamic array checking
php dynamic array checking  php dynamic array checking
php dynamic array checking
php dynamic array checking  php dynamic array checking
create dynamic array in javascript
create dynamic array in javascript  How to create dynamic array in javascript
dynamic textfields
dynamic textfields  Hi, I am a fresher and joined recently in one company. they gave me a desktop application project using swings.here is my detailed spec Screen 1 - The user enters the ingredients from a food product, saves
Dynamic table in jsp
Dynamic table in jsp  Hi..... I have a java file to read excel file. I have stored all the elements of excel file in a variable. Now i want to show all values of excel file on jsp page in a table format. All elements
Dynamic form
Dynamic form  I need to make a dynamic form using jsp for example, i will need a list of items which when we select one option another list is modified ( like 2 lists of countries and citys ), and also a radio button wich once

Ads