My client wants to have users fill out a form on their web site that will compile as an Excel file. I saw an earlier post about how to do this with ASP, but I am running the site on an Apache server so I will need either a PHP method or perhaps Javascript? I know nothing about PHP, but need to learn it eventually. I don't want to simply be handed the code, I would like to understand the logistics of the process as well. Anything you guys can provide would be most helpful. Thanks in advance!
Regards,
Padraic Ryan
I don't want to simply be handed the code
Now that is a good thing to hear. :)
Well, since excel reads comme delimited files you could store it that way. Excel has no problems opening them and php has no problems writing them.
The logic of the whole thing would be
You have a form that uses the POST method and the action is set to a php script.
That php script would read/validate the information from the $_POST [php.net] associative array and if it validates it would open a pointer to the .csv file where you are storing the data using fopen [php.net].
It would then put the data from the form into the structure it wants to store in the file using concatenation [php.net] or maybe using sprintf [php.net]
It then writes the line to the file using fwrite [php.net].
then close the file pointer using fclose [php.net].
Then it may either echo [php.net] some confirmation message or send them off to another page using header [php.net]
-Padraic
I'm using this in several sites, and it works fine in all modern browsers.