hi,
im doing it in jsp and my backend is my sql ... im inserting the checkbox values and some details in table but for checkbox values i have given the executequery statement(where we write query) as integer so all other string details are not inserted in table it show "null" value in table...Pls any one help me..this is my coding..(only my seat1 to seat5 value are getting inserted)
<%@page import="java.sql.*, java.lang.String,Java.Util.*"%>
<%
String TicketRate= request.getParameter("Ticket Rate");
String ShowTime= request.getParameter("Show Time");
String ShowDate= request.getParameter("Show Date");
String NoOftickets= request.getParameter("No Of tickets");
String Film= request.getParameter("Film");
String checkValues[]=request.getParameterValues("vehicle");
String value="";
String valu="";
String val="";
String va="";
String v="";
String conURL="jdbc:mysql://localhost/cinema?";
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(conURL,"root","root");
for(int i=0;i<checkValues.length;i++)
{
if(i==0)
{
value+=checkValues[0];
}
else if(i==1)
{
valu+=checkValues[1];
}
else if(i==2)
{
val+=checkValues[2];
}
else if(i==3)
{
va+=checkValues[3];
}
else
{
v+=checkValues[4];
}
}
Statement st=con.createStatement();
int j=st.executeUpdate("insert into seatings(TicketRate,ShowTime,ShowDate,NoOfTickets,Film,seat1,seat2,seat3,seat4,seat5) values('"+TicketRate+"','"+ShowTime+"','"+ShowDate+"','"+NoOftickets+"','"+Film+"','"+value+"','"+valu+"','"+val+"','"+va+"','"+v+"')");
out.println("Inserted successfully");
%>