-
Notifications
You must be signed in to change notification settings - Fork 0
/
sellToInd.jsp
79 lines (67 loc) · 2.55 KB
/
sellToInd.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import = "java.sql.*" %>
<%@ page import = "javax.sql.*" %>
<%@ page import = "java.io.*" %>
<%@ page import = "java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>User Panel</title>
<link rel="stylesheet" type="text/css" href="headerStyle.css">
<link rel="stylesheet" type="text/css" href="signupstyle.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins">
</head>
<body>
<%
String department = request.getParameter("department_list");
String itemname = request.getParameter("itemname");
//String image = "";
String contact = request.getParameter("contact");
String location = request.getParameter("location");
String description = request.getParameter("description");
Object uname = session.getAttribute("uname");
String departmentId = new String();
String uid = new String();
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/trade", "root", "");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM departments WHERE department_name='"+department+"'");
while (rs.next())
{
departmentId = rs.getString("department_id");
}
//st.executeUpdate("INSERT INTO imgs (img_name) VALUES ('"+image+"')");
rs = st.executeQuery("SELECT * FROM users WHERE username='"+uname+"'");
while (rs.next())
{
uid = rs.getString("user_id");
}
st.executeUpdate("INSERT INTO items (user_id, item_name, department_id, contact, location, description) VALUES ('"+uid+"','"+itemname+"','"+departmentId+"','"+contact+"','"+location+"','"+description+"');");
%>
<div class="nav">
<div class="header">
<h1><a href="index.jsp">Online<br>Trade</a></h1>
</div>
<div class="user_login">
<a href="userPanel.jsp">Welcome <%=session.getAttribute("uname")%></a>
<br><br><br>
<a href="shoppingList.jsp">Shopping List</a>
<br><br><br>
<a href="sell.jsp">Sell</a>
<br><br><br>
<a href="logout.jsp">Log out</a>
</div>
</div>
<div class="content">
<h3 style="color:black; font-size:24px; font-family:'Poppins', sans-serif;">
Selling it!
</h3>
<br>
<h3 style="color:black; font-size:24px; font-family:'Poppins', sans-serif;">
<a href='index.jsp'>Please Go to the Home Page.</a>
</h3>
</div>
</body>
</html>