| |
madtim67
Posts: 1
Score: 0
Joined: 6/8/2006
Status: offline
|
Can anyone tell me with this code? At the moment I enter an email into index.html and when I click submit the email address passes to add_email.asp which writes the email to email.xml. Have a look - www.madtim67.com The code then shows the xml file on screen but I want to redirect it to another page (just back to index.html). I've tried a few things but none of them seem to have the desired effect. add_email.asp -------------- <% @LANGUAGE = "VBScript" %> <% Dim xmlFile Dim xmlRoot Dim xmlNode Dim strTitle Dim strError Dim strPath strPath = Server.MapPath("db/email.xml") Set xmlFile = Server.CreateObject("Microsoft.XMLDOM") xmlFile.Async = False If Not xmlFile.Load(strPath) Then Call Server.Transfer("invalid.html") End If Set xmlRoot = xmlFile.DocumentElement Set xmlNode = xmlFile.CreateElement("message") Call xmlNode.SetAttribute("timestamp", Now) Call xmlRoot.AppendChild(xmlNode) Set xmlRoot = xmlNode Call CreateElementNode("user","userName",xmlNode) Call xmlFile.Save(strPath) Call Server.Transfer("db/email.xml") Sub CreateElementNode(elementName, formElement, node) Set xmlNode = xmlFile.CreateElement(elementName) xmlNode.Text = Request(formElement) Call xmlRoot.AppendChild(node) End Sub %> P.S can anyone help me with checking to see if the email address entered already exists in email.xml
|
|