Btw, Here is what I did, but i cant seem to retrieve the SpecialID at case "additems". Its like SpecialID comes back empty.
I also want to add more than one item at a time. How do I do that?
Here is my code:
<%
Dim Con, rsQuery
'Need to initialise all Database stuff first!
Set Con = Server.CreateObject("ADODB.Connection")
Set rsQuery = Server.CreateObject("ADODB.Recordset")
SpecialID = Request.QueryString("SpecialID")
strAction = Request.QueryString("Action")
'response.write request.servervariables("REMOTE_HOST")
'response.end
connStr = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=" & server.mappath("/database/content.mdb") & ";" & _
" Uid=Admin;" & _
"Pwd=;"
Con.Open connStr
'response.write (connStr)
'response.end
strTitle= Request.Form("SpTitle")
strLink= Request.Form("SpMoreInfoLink")
strStartDate= Request.Form("SpDateStart")
strEndDate= Request.Form("SpDateEnd")
strItemName= Request.Form("SpName")
strItemDesc= Request.Form("SpDesc")
strItemPrice= Request.Form("SpSalePrice")
strItemDel1= Request.Form("SpDeliveryTime")
strItemDel2= Request.Form("SpDeliveryPrice")
strItemPayType= Request.Form("SpPaymentType")
strSubmit = Request.Form("Submit")
If strSubmit = "Submit" Then
'// Here we need to do all the database processing
'// and updating.
If action = addspecial Then
Con.Execute("INSERT INTO Specials(SpTitle,SpMoreInfoLink,SpDateStart,SpDate End) VALUES(' " & strTitle & " ',' " & strLink & " ',' " & strStartDate & " ',' " & strEndDate & " ')")
Set rsQuery = Con.Execute("SELECT SpecialID FROM Specials")
'Response.Redirect ("add_special.asp?action=additems&SpecialID=" & SpecialID)
Else If action = additems Then
Con.Execute("INSERT INTO SpecialItems(SpName,SpDesc,SpSalePrice,SpDeliveryT ime,SpDeliveryPrice,SpPaymentType) VALUES(' " & strItemName & " ',' " & strItemDesc & " ',' " & strItemPrice & " ',' " & strItemDel1 & " ',' " & strItemDel2 & " ',' " & strItemPayType & " ')")
Set rsQuery = Con.Execute("SELECT SpItemID FROM SpecialItems")
'Response.Redirect "add_special.asp?action=addspecial"
End If
End If
Else
End If
Select Case strAction
Case "addspecial"%>
<form NAME="form1" METHOD="post" ACTION="add_special.asp?action=additems&SpecialID= <%=SpecialID%>">
<table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<tr>
<td>
Special Title: <input type="text" size="50" name="SpTitle" value="">
</td>
</tr>
<tr>
<td>
Special Link: <input type="text" size="50" name="SpMoreInfoLink" value="">
</td>
</tr>
<tr>
<td>
Special Start Date: <input type="text" size="50" name="SpDateStart" value="">
</td>
</tr>
<tr>
<td>
Special End Date: <input type="text" size="50" name="SpDateEnd" value="">
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit" name="submit">
</td>
</tr>
</table>
</form>
<%Case "additems"%>
<form NAME="form1" METHOD="post" ACTION="add_special.asp?action=addspecial">
<table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<tr>
<td>
Special Item Name: <input type="text" size="50" name="SpName" value="">
</td>
</tr>
<tr>
<td>
Special Item Desc: <input type="text" size="50" name="SpDesc" value="">
</td>
</tr>
<tr>
<td>
Special Item Price: <input type="text" size="50" name="SpSalePrice" value="">
</td>
</tr>
<tr>
<td>
Special Item delivery time: <input type="text" size="50" name="SpDeliveryTime" value="">
</td>
</tr>
<tr>
<td>
Special Item Deliery price: <input type="text" size="50" name="SpDeliveryPrice" value="">
</td>
</tr>
<tr>
<td>
Special Item payment type: <input type="text" size="50" name="SpPaymentType" value="">
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit" name="submit">
</td>
</tr>
</table>
</form>
<%End Select%>
|