[go: up one dir, main page]

Menu

[773754]: / web / removecart.jsp  Maximize  Restore  History

Download this file

27 lines (26 with data), 870 Bytes

 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
<%@page contentType="text/html" pageEncoding="UTF-8" import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
try{
String id=request.getParameter("cid");
Class.forName("com.mysql.jdbc.Driver");
Connection c=DriverManager.getConnection("jdbc:mysql://localhost/products","root","");
Statement st=c.createStatement();
int r=st.executeUpdate("delete from cart where cart_id="+id);
if(r>0)
{
out.println("<script>alert('Item removed from cart!');window.location.assign('view_cart.jsp');</script>");
}
}catch(Exception e)
{
out.println(e);
}
%>
</body>
</html>