Hi monks, I have a cgi form that takes user input ,queries a database on the given parameters and generates a table.
I would like to give an option of saving this table as a CSV file.
I can convert the table to csv.my problem is i cannot figure out how to deal with the fact that the web page can be accessed from anywhere and i have to give an option for the user to save the table to a csv file on his disk.
(only thing i can think of is to take email address as an input and mail him the file).i am sure there is a better way.
Any suggestions?
Regards,
chimni
UPDATE:Matija: Yes, upon clicking a button i want the data in the table to be saved as a csv file.
So your saying i should make a sub-routine,call it on click,write the headers your provided [Content-type=application/octet-stream; filename="some_filename"],convert my html to csv and output it

In reply to Save HTML table as CSV on local disk by chimni

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.