-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignupprocess.jsp
30 lines (27 loc) · 968 Bytes
/
signupprocess.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<%@ page import ="java.sql.*" %>
<%
String username = request.getParameter("s_username");
String password = request.getParameter("s_password");
String name = request.getParameter("s_name");
String dob = request.getParameter("s_dob");
String phone = request.getParameter("s_phone");
//out.println(username);
//out.println(password);
//out.println(name);
//out.println(dob);
//out.println(phone);
//password = name = dob = phone = Null;
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/poll","root", "");
Statement st = con.createStatement();
try{
session.setAttribute("username", username);
String sql = "Insert into users (username,name,dob,password,phone) values('"+ username +"','" + name +"','" + dob +"','" + password +"','" + phone +"')";
st.executeUpdate(sql);
response.sendRedirect("poll.html");
}
catch(Exception e)
{
out.println(e);
}
%>