<%option explicit%> <% dim rsPosts, rsPostTypes, strSQL, strFilter, bNew, bValid, bDeleted, i dim strID, strTitle, strDetail, strEmail_Entered, strContact, dtDateAdded, strFirst_Name, strLast_Name, strEmail, ID_Post_Type dim bTitle_Missing bValid = true bDeleted = false set rsPosts = Server.CreateObject("ADODB.RecordSet") set rsPostTypes = Server.CreateObject("ADODB.RecordSet") strID = Request.QueryString("id") : if strID = 0 then bnew = true else bNew = false strFilter = Request.QueryString("post_type") strSQL = "SELECT tblUser.strFirst_Name, tblUser.strLast_Name, tblUser.strEmail, tblPost.* " &_ "FROM tblUser INNER JOIN tblPost ON tblUser.ID_User = tblPost.ID_User " &_ "WHERE tblPost.Inactive = 0 AND ID_Post = " & strID rsPosts.Open strSQL, oConn, 1, 3 if Request.Form <> "" then ' Get out all values from form strTitle = Replace (Trim (Request.Form("strTitle")), "'", "''") strDetail = Replace (Trim (Request.Form("strDetail")), "'", "''") strContact = Replace (Trim (Request.Form("strContact")), "'", "''") strEmail = Replace (Trim (Request.Form("strEmail")), "'", "''") ID_Post_Type = Request.Form("ID_Post_Type") if strTitle = "" then bTitle_Missing = true bValid = false end if ' Now insert / update data. if bValid then if bNew then strSQL = "INSERT INTO tblPost (strTitle, strDetail, strContact, strEmail, ID_User, ID_Post_Type) " &_ "VALUES ('" & strTitle & "', '" & strDetail & "', '" & strContact & "', '" & strEmail &_ "', " & intUserID & ", " & ID_Post_Type & ")" else strSQL = "UPDATE tblPost SET " &_ "strTitle = '" & strTitle & "', strDetail = '" & strDetail &_ "', dtDateAdded = '" & Day(Now()) & " " & MonthName(Month(Now()), true) & " " & Year(now()) &_ "', strContact = '" & strContact & "' , strEmail = '" & strEmail & "', ID_User = " & intUserID & "," &_ " ID_Post_Type = " & ID_Post_Type & " " &_ "WHERE ID_Post = " & strID end if oConn.Execute strSQL end if elseif not bNew then strTitle = rsPosts("strTitle") strDetail = rsPosts("strDetail") strContact = rsPosts("strContact") strEmail = rsPosts("strEmail") dtDateAdded = rsPosts("dtDateAdded") strFirst_Name = rsPosts("strFirst_Name") strLast_Name = rsPosts("strLast_Name") strEmail_entered = rsPosts("strEmail") ID_Post_Type = rsPosts("ID_Post_Type") end if if Request.QueryString("delete") = "1" then oConn.Execute "UPDATE tblPost SET Inactive = 1 WHERE ID_Post = " & strID bDeleted = True end if %> Guidelines Web Site - Posting detail, <%=strTitle%> <% dim This_Page : This_Page = "post_detail" %>
<%if (Request.Form <> "" and bValid) or bDeleted then%> <%else%> <%end if%>

Posts details – <%=strTitle%>

<%if Request.Form <> "" and bValid then%>

Thank you, your posting is now live on the Guidelines site.

<%elseif bDeleted then%>

The post has now been deleted.

<%end if%>

<%if bNew then%>Add another or <%end if%>Go to main list

<%if rsPosts.EOF and not bNew then%>

There has been an error retrieving this post.

<%else%> <%if bTitle_Missing then%> <%end if%> <%if not bNew then%> <%end if%>

Please enter your title.

<%=FormatDateTime (dtDateAdded, vbLongDate)%>
<%=strFirst_Name & " " & strLast_Name%>
<%=strEmail_entered%>
<%if not bNew then%> <%end if%>
<%end if%>