%
function yesno(entry)
if entry = "1" then
yesno = -1
else
yesno = 0
end if
end function
if request("action") = "Cancel" then
response.redirect "menu.asp"
elseif request("action") = "Remove From Order" then
sql = "DELETE FROM tbl_oline WHERE id=" & request("oline_id")
cnn.execute sql
cnn.close
set cnn = nothing
response.redirect "menu.asp"
elseif request("action") = "Add to Order" or request("action") = "Save Changes" then
if request("qty") = "" then
msg = "Please enter the Quantity before clicking add to order."
elseif request("label") = "" then
msg = "Please enter Whose food is this? before clicking add to order."
elseif not isnumeric(request("qty")) then
msg = "Please enter a numeric Quantity before clicking add to order."
elseif request("tortilla") = "" then
msg = "Please choose a Tortilla flavor before clicking add to order."
else
price = request("price")
sql = "INSERT INTO tbl_oline (order_id, product_id, qty, price, label, tortilla) " & _
"VALUES (" & _
session("order_id") & ", " & _
request("id") & ", " & _
request("qty") & ", " & _
price & ", " & _
"'" & replace(request("label"), "'", "''") & "', " & _
"'" & request("tortilla") & "')"
cnn.execute sql
if request("action") = "Save Changes" then
sql = "DELETE FROM tbl_oline WHERE id=" & request("oline_id")
cnn.execute sql
end if
cnn.close
set cnn = nothing
response.redirect "menu.asp"
end if
tortilla = request("tortilla")
label = request("label")
qty = request("qty")
end if
pid = request("id")
if request("oline_id") <> "" then
sql = "SELECT * FROM tbl_oline WHERE id=" & request("oline_id")
set rs = server.createobject("adodb.recordset")
rs.open sql, cnn, 1, 3
if not rs.eof then
pid = rs("product_id")
tortilla = rs("tortilla")
label = rs("label")
qty = rs("qty")
end if
rs.close
set rs = nothing
end if
%>
<%
if request("qty") <> "" then qty = request("qty")
if qty = "" then qty = "1"
set rs = server.createobject("adodb.recordset")
sql = "SELECT * FROM tbl_product WHERE id=" & pid
rs.open sql, cnn, 1, 3
if msg <> "" then response.write "" & msg & ""
%>