What do you think would be the easiest way to data from a form saved to an excel documents when submit button is pressed ?
You can change the header of the page that you post to and write out the page as an Excel file. The content should be written out as if you are creating a normal html file, but it actually opens in Excel. Here is the code I use in ASP to do it: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!--#include file="21st_common.asp" --> <% if trim(session("CustomerCompanyId")) = "" then response.redirect "index.asp" end if ' open as an excel spreadsheet if excel=true if request.querystring("excel") = "true" then 'NOTE: MS Excel 2000 SP1 is required to render the HTML of this page into an Excel Spreadsheet Response.Clear Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "Content-Disposition", "attachment; filename=MultiMgmtReport.xls" end if %>
Don't have the code for it but I'd probably do a Google search for "php contenttype addheader excel" or something like that.
The above code doesnt actually "output" Excel but tells the browser to open the page in Excel so if the end user doesnt have Excel or an Excel viewer installed then they wont be able to use it where as a true conversion would at least allow them to save it as a true Excel file. A CSV file is possibly the better route on the basis it is a universal file type that all computers will be able to open as even a basic text editor can open it but Excel also have native support to open them (you dont have to import) To output a true Excel file isnt the easiest of things to do, whilst we can do it using .Net I know a fairly good php programmer gave up on the project when they attempted to do it.