For Programmers: Free Programming Magazines  


Home > Archive > ASP > June 2007 > Write from an html form to csv format









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Write from an html form to csv format
nufanvandal@gmail.com

2007-06-15, 6:56 pm

Hello,

I created a web form in html, I need to create a server-side script
using ASP and embed it into the html, so that when the user clicks
submit, it sends(saves) the data from text boxes, drop-downs etc, to a
text(.txt) file on the server. It needs to be in csv format so that
they can create an excel file from it. I'm not familar with this type
of task, so any help is appreciated.

So basically two things.

How to write to a file on the server using the data from the form.
How to have the data in csv format when written.

Thanks!

Adrienne Boswell

2007-06-16, 7:56 am

Gazing into my crystal ball I observed nufanvandal@gmail.com writing in
news:1181921018.926798.7960@k79g2000hse.googlegroups.com:

> Hello,
>
> I created a web form in html, I need to create a server-side script
> using ASP and embed it into the html, so that when the user clicks
> submit, it sends(saves) the data from text boxes, drop-downs etc, to a
> text(.txt) file on the server. It needs to be in csv format so that
> they can create an excel file from it. I'm not familar with this type
> of task, so any help is appreciated.
>
> So basically two things.
>
> How to write to a file on the server using the data from the form.
> How to have the data in csv format when written.
>
> Thanks!
>
>


I would say to create a file on the server, then write to that file
whilst looping through the response.form collection.

dim fs,tf
dim ix, field, inputvalue
dim headers, dataline

set fs=Server.CreateObject("Scripting.FileSystemObject")
set tf=fs.CreateTextFile("c:\somefile.txt")

for ix = 1 to request.form.count
field = request.form.key(ix)
inputvalue = request.form.item(ix)
if not isnumeric(inputvalue) then
'puts quotes around text fields
inputvalue = chr(034) & inputvalue & chr(034)
end if
headers = headers & field & ", "
dataline = dataline & inputvalue & ", "
next
headers = left(headers,len(headers)-2)
dataline = left(dataline,len(dataline)-2)

'if you want the first line to contain data headers then
tf.writeline headers
'now put the data
tf.writeline dataline

tf.close
set tf=nothing
set fs=nothing

Of course, you could also just skip the csv and output directly to Excel.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Tino

2007-06-19, 3:53 pm

Carmen Electra and Pamela Anderson Slobbering Each Other!
http://www.shockingonline.com/MediaPlayer.wmv?q=726648

hentai movie xxx gratis juegos porn free retro porn movie free cartoon hentai video mature sex video
adult drunk free girl movie free gay male porn video free music video adult movie vintage usher yeah lyric
gratis muy postales sensuales cum shot video post xxx alex movie free latina xxx video cat fight online video
musica gratis en espanol clip free sex video xxx booty movie xxx video gratis tv sexo video post

free fat woman porn video
naruto game video clip
free movie sex cindy lange
gay video post
free hot porn video
britney party picture spear
game video wii
de gratis sexo video web
free video game maker
dvd movie vivid
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com