Daniel Brooke Peig
Form2CSVtable

Por Daniel Brooke Peig (http://www.danbp.org)


Download version 2.1 (10/5/2007): form2csvtable.zip - 4KB - License GNU/GPL

English:

This application will convert all data submited by an HTML form to a CSV table located in the same folder as the script.
The generated CSV file follows the RFC4180 standarts.

Requirements:

- Read/Write permissions of the script folder or destination file (safer).

- PHP version > 4.0


Instructions:

- Use the POST action on the HTML form to be submitted.

- Your FORM must have the following HIDDEN fields:
table_name : The value from here will be used as the filename of the destination table (any extensions will be ignored)
redirect: The URL of the page where the user will be sent after the script is finished.

- (Optional) Edit the "field_delimiter" setting to adjust how the fields will be separated in the CSV table. The default value is "," (comma) and should work in most of the cases.

- (Optional) Edit the "strip_lines" setting to allow line breaks in the table cells.

- Edit the "reserved_names" on the PHP script and add all the posted vars you don't want to be exported to the CSV file. The default list already has the common names.

IMPORTANT: If you are having trouble while opening the CSV files on Excel, verify the "field_delimiter" setting.


Português:

Este programa converterá todos os dados enviados através de um formulário HTML em um arquivo CSV localizado na mesma pasta do script.
O arquivo CSV gerado atende a norma RFC4180.

Requisitos:

-Permissões de Leitura e Escrita na pasta ou no arquivo CSV (apenas no CSV é mais seguro)

-PHP versão 4.0 ou superior

Instruções:

- Use a ação do tipo POST no formulário HTML.

- Seu formulário precisa possuir os seguintes campos OCULTOS (Hidden):
table_name : O nome do arquivo da tabela de destino (quaisquer extensões serão ignoradas e substituídas por CSV)
redirect: A URL/endereço da página para onde o usuário será enviado após o processamento do formulário.

- (Opcional) Edite o campo "field_delimiter" para definir como as colunas serão separadas no arquivo CSV. A configuração padrão é "," (vírgula) e deve funcionar na maioria dos casos.

- (Opcional) Edite o campo "strip_lines" para permitir que as células da tabela tenham quebras de linha.

- Edite a "reserved names list" e adicione o nome dos campos/variáveis do formulário que você não quer que sejam enviadas à tabela. A lista padrão já tem os nomes mais comuns.

IMPORTANTE: Se você estiver tendo problemas em abrir a tabela no Excel ou em outros progamas de planilha, verifique a configuração do "field_delimiter".


Daniel Brooke Peig
http://www.danbp.org