You are here: $_POST and CSV File « All PHP « IT news, forums, messages
$_POST and CSV File

Posted by Michel Beaussart on 10/13/60 11:30

Consider the following:
<?php
setcookie ("start", time());
$array = array("block1.html","block2.html","block3.html");
shuffle($array);

include ("formopen.html");// contains Html Header and Form Tags
include("$array[0]");
include("$array[1]");
include("$array[2]");
include ("formclose.html"); // contains html end tags + submit button


?>

The form is split in 3 parts. The order is random. How do I save the
info from a $_POST into a csv file that has a specific header? (NOTE:
Each element of the form is named after a column into the csv file)

I know that the following does not do it.

//Open csv file and grab first row
$fp = fopen ("data/data.csv",'a+'); // open file
$data = fgetcsv($fp, 1000, ","); // get csv

// write data in a csv file


foreach ($_POST as $data => $v) //data is over written ..:(
{

fwrite ($fp, "$v,");
;
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация