sir i have created an .asp script with the help of your site, i have gone through some forum posts and with some r&d i have accomplish the task howerver i need to do one more thing and i am unable to develop it myself. i tried some r&d but failed therefore i seek your help. please do help me
i have an contact us form in my website and i have created an asp script for it and it is working fine. now i need a little more from it.
i need that whenever any person fills the form to contact me his details get stored in an excel file placed in a folder in the website and the date get append in to it subsequently. i know it is possible but i dont how how to code it in the same asp script. my script is as under
UserIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If UserIPAddress = "" Then
UserIPAddress = Request.ServerVariables("REMOTE_ADDR")
strFeedTitle = Request.Form("Title")
strFeedName = Request.Form("Name")
strFeedEmail = Request.Form("Email")
strFeedCell = Request.Form("Cell")
strFeedCompany = Request.Form("Company")
strFeedSubject = Request.Form("Subject")
strFeedMessage = Request.Form("Message")
myMail.Subject="Msg. from Website "
strAutoReply="<html><body style='color:#333; font-family:Verdana; font-size:12px'><p>Dear<span style='font-weight:bold'> " & strFeedTitle & " " & strFeedName & "</span></p><p>Thanks for contacting us</p><p>Your mail has been submitted successfully and we will get back to you within three working days</p></p><br /><p>Regards</p><p>ADDBOSS <br> Corporate services consultants <br> www.addboss.in <br><br><br><br><br><hr><p style='color:#595959; font-size:10px;'><span style='font-weight:bold'>Note: </span>This is an auto response-back mail from the server of ADDBOSS for the acknowledgement of your submission. Please do not reply on this mail. However, if you need to contact us any further you may directly write to us on email@example.com</p></body></html>"
myMail2.Subject="Auto-Reply from ADDBOSS"
please help me.
if you need some more details please ask me and i will provide it here.
Just before the Response.Redirect line at the end, add this code:
CONST QT = """" ' creates a single quote mark
' put the items into the array in whatever order you prefer:
csvItems = Array( UserIPAddress, strFeedTitle, strFeedName, strFeedEmail, _
strFeedCell, strFeedCompany, strFeedSubject, strFeedMessage )
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set csv = FSO.OpenTextFile( Server.MapPath("emailLog.csv"), 8, True )
csv.WriteLine QT & Join( csvItems, QT & "," & QT ) & QT
Set FSO = Nothing
The only thing to watch out for is here:
Aside from the fact that you can use any file name of your choice, though it should end in ".csv", that code as written probably won't work. That says "find the CSV text file in the same directory as this code." Almost surely the directory with the code will *NOT* be writable.
Typically, you will have a writable "data" directory that is either a subdirectory of the code directory or is "besided" the code subdirectory. So you will likely need something such as
You will have to figure that part out based on the directory structure on your machine.
This code should write out a CSV file that looks like
"184.108.40.206","Amalgamated Widgets","Today's Widget Report","...", etc.
TWO CAUTIONS: In a ".csv" file like this, *NONE* of the field may contain *EITHER* quote marks or new line characters.
If you are unsure if they might, you could use a "cleaner" function something like:
Function clean( txt )
clean = Replace( Replace( Replace( txt, """","'" ), vbCR, " ", vbLF, " " )
So grateful to you,
i really owe you a lot, it was overwhelming.
the code worked so perfectly.
first off all i got afraid to implement this but than i slowly read all the lines and finally implement with the first step by copying the first block of code in my asp file and then uploaded the file to the server.
i than filled the form and checked the folder on the server, there was a file created with the name emaillog.csv. i then download the file and opened in excel and it got opened with all the details of the form. the first test got passed.
now i filled the form again and checked the folder, i simply refresh the folder in my fpt Clint (filezila) and i noticed that the size of the emaillog.csv has increased by a bit.
i download the file again and checked the values. i cant tell you my happiness, the purpose i have been looking for like hell is solved. the data is getting appended to the previous data. i mean now i will have this same file to collect all the data of the form filler.
this is so amazing, i mean just a few line of codes have done this work.
really a programmer can do anything.
i am so thankful to you. if you don't mind can i know you name and email id. or you can send me mail on firstname.lastname@example.org
sir, with your help i have create a well to do script for my contact us form.
however there is one more thing i wanted to add in my form. that is the captcha. how do i add a captcha to my form so that any form submission pass through the anti spam guideline and does not goes into junk mails.
is there any script available for it or any asp code is required to create that. please help me to understand this functionality. i will be again great-full to you.
however one more thing i need to ask from you. with the current asp script i am able to send auto response and get the data append in the csv file. which i further pull with my excel to update the data.
i need to add one more variable in that array which gives the date and time stamp or may be two separate variables for date and time of the form submitter.
as a temporarily arrangement i have added an hidden input field with a java script code for the date and time, but the results are different at times, so i am planing to seek this help from you, that is to say let asp script does this trick for me. the only condition is that i need the current date & time of the senders system or the time should be Indian standard time in the format dd/mm/yyyy, 12:00:am/pm. please arrange this code for me. please refer my above asp script for the answer.