View Full Version : submit form data to a txt file
Ninkasi
03-31-2004, 12:39 AM
Hey all.
I'm wanting to have a small function of letting a user submit questions inorder to get a FAQ page up and running. What I want to happen is they type in the question into a form field, and when they submit, that data gets written to a txt file.
Is this possible?
kevin
03-31-2004, 04:24 AM
yes it is possible.
putts
03-31-2004, 07:51 AM
If you work with Kram, you prolly use ASP.
With ASP, you can easily use a FileSystemObject to create a new file to hold this FAQ or even append the new FAQ to the end of a FAQ file that you already have (so you only need one file).
Are you on ASP also? If not, I'm sure the other languages have similar abilities.
Ninkasi
03-31-2004, 04:50 PM
Yeh, I'm using ASP also. Is it just a simple request.write or something?
putts
03-31-2004, 10:43 PM
This is the page that I send everybody to first when they want to use FileSystemObjects...
http://www.4guysfromrolla.com/webtech/faq/FileSystemObject/faq3.shtml
If you still have some questions after that, fire away :D
Ninkasi
03-31-2004, 11:24 PM
thanks heaps putts!! I'll check that out! :D
Ninkasi
03-31-2004, 11:32 PM
How can I send an email at the same time?? or is that already been covered?
Ninkasi
03-31-2004, 11:33 PM
how do I send an email at the same time?? Or is that already been asked in another thread??
Ninkasi
03-31-2004, 11:35 PM
sorry guys.. Our work internet is stuffing up. Sorry for the double posts!!!!
Ninkasi
04-01-2004, 12:35 AM
Would this work??
<% @ LANGUAGE = VBScript %>
<% Option Explicit %>
<%
Const ForReading = 1, ForWritting = 2, ForAppending = 8
Const TristateUseDefault = -2
Const TristateTrue = -1
Const TristateFalse = 0
Dim objFS, objTextS, strLine
Set objFS = Server.CreateObject("Scripting.FileSystemObject")
If objFS.FileExists("blah.txt") = True Then
Set objTextS = objFS.OpenTextFile("blah.txt", ForAppending, False, TristateFalse)
Else
Set objTextS = objFS.CreateTextFile("blah.txt", False, False)
objTextS.WriteLine "This file was created at: " & Now
objTextS.WriteLine ""
End If
objTextS.WriteLine "Name: " & (request.form("fname"))
objTextS.WriteLine "E-mail: " & (request.form("eMail"))
objTextS.WriteLine "Question: " & (request.form("question"))
objTextS.WriteLine "Time: " & Now
objTextS.WriteLine ""
objTextS.close
dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = (request.form("eMail"))
objMail.Subject = "FAQ Question"
objmail.To = "someone@somewhere.com"
objMail.Body = "This is a test, but here is the question\n " & (request.form("question"))
objMail.Send
Response.Redirect("somepage.asp")
%>
putts
04-01-2004, 06:03 AM
it should...yes
Ninkasi
04-01-2004, 04:54 PM
I don't think it is for some reason. I tired to send it to about 4 or 5 different email addys, and none of them worked... Maybe our server is blocking them?
putts
04-01-2004, 08:38 PM
I just keep getting some stupid error on the createTextFile....argh
putts
04-01-2004, 09:07 PM
heheheheeheee....tricky user permissions IUSER :D
anyhow...it's doing the same thing for me!!! :eek:
Ninkasi
04-01-2004, 09:53 PM
So the code looks good to you??
Ninkasi
04-01-2004, 10:23 PM
it says on 4guys that CDONTS can only be used on NTservers...
putts
04-01-2004, 11:17 PM
ahhhhhhhhh...that would explain some things
such as the emergance I've noticed of a bunch of non-CDONTS ASP email components and the fact that CDONTS doesn't come registered on XP machines.
There are plenty of alternatives out there though.
Ninkasi
04-01-2004, 11:22 PM
I'm checking with the server gurus here at work to see if it is enabled or whatever. If not, then hopefully they can enable it for me, or I will look into others
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.