DELEGATE FORM
DELEGATES INFORMATION:
DELEGATE DETAILS
<%@ page import="java.sql.*,java.util.*"%>
DELEGATE INFORMATION IS STORED SUCCESSFULLY
<%
String delegatename=request.getParameter("delegatename");
String delegatetype=request.getParameter("delegatetype");
String designation=request.getParameter("designation");
String department=request.getParameter("department");
String address=request.getParameter("address");
String phonenumber=request.getParameter("phonenumber");
out.print(" ");
out.println("DELEGATENAME "+delegatename+" ");
out.println("DELEGATETYPE "+delegatetype+" ");
out.println("DESIGNATION "+designation+" ");
out.println("DEPARTMENT "+department+" ");
out.println(" ADDRESS "+address+" ");
out.println("PHONENUMBER "+phonenumber+" ");
String question1=request.getParameter("question1");
String question2=request.getParameter("question2");
out.println("q1 "+question1+" ");
out.println("q2 "+question2+" ");
out.print("
");
try {
String connectionURL = "jdbc:mysql://localhost:3306/mytestdb";
Class.forName("com.mysql.jdbc.Driver") .newInstance();
Connection connection = DriverManager.getConnection(connectionURL,"root","");
PreparedStatement p=connection.prepareStatement("insert into delegateinfo values('"+delegatename+"','"+delegatetype+"','"+designation+"','"+department+"','"+address+"','"+phonenumber+"')");
int rs=p.executeUpdate();
if(rs>0)
{
out.print("DATA INSERTED SUCCESSFULLY");
}
else
{
out.print(" NOT CONNECTED");
}
if(!connection.isClosed())
out.println("Successfully connected to " + "MySQL server using TCP/IP...");
connection.close();
}
catch(Exception ex){
out.println("Unable to connect to database."+ex);
}
%>