%@ Language=VBScript %>
<%Response.Buffer=True%>
<% Updated = Request.QueryString("Updated") %>
<% PageTitle = "SiteManager - Add New Products" %>
<% PageID=202 %>
<% Header %>
<% Menu PageID %>
<%' Main body of page goes here ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %>
<%ProductAdd%>
<%' End Of Main body ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %>
<% Footer %>
<% Sub ProductAdd
error = ""
OpenConnection1
SET rs=Server.CreateObject("ADODB.Recordset")
If Request.ServerVariables ("REQUEST_METHOD") = "POST" then
txtProduct = TRIM(Request.Form("txtProduct"))
txtTeaser=Trim(Request.Form("txtTeaser"))
nCatID = Request.Form("selCat")
txtDescription = TRIM(Request.Form("txtDescription"))
txtManufacturer = TRIM(Request.Form("txtManufacturer"))
txtManURL = Trim(Request.Form("txtManURL"))
If txtProduct<>"" And txtDescription<>"" And nCatID<>0 then
SEL="SELECT * FROM Products"
rs.Open SEL,DB,1,3
rs.AddNew
rs("nCatID")=nCatID
rs("txtProduct")=dbReplace(txtProduct)
rs("txtTeaser")=dbReplace(txtTeaser)
rs("txtDescription")=dbReplace(txtDescription)
rs("txtManufacturer")=dbReplace(txtManufacturer)
rs("txtManURL")=dbReplace(txtManURL)
rs.Update
ProdID = rs("ProductID")
rs.Close
Response.Redirect ("Product_Details.asp?PID=" & ProdID)
Else
If txtProduct="" then
error="The Product Name is required.
"
End If
If txtDescription="" then
error=error & "The Product Description is required.
"
End If
If nCatID=0 then
error=error & "Please select a Product Category.
"
End If
End If
End If
Sel="Select * FROM PCategories"
rs.Open Sel,DB,1,3
If rs.EOF then
rs.Close
Response.Redirect("PCategory_Add.asp?PA=1")
End If
%>
<%= FormatDateTime(Date,1)%>
<%End Sub%> <% Function IsSelected(value,data) If value=data then IsSelected="Selected" Else IsSelected="" End If End Function %>