help please. i have this form with input fields.

how could i save the data entered on the input boxes on a CSV file upon hitting submit button.

thanks.

    fopen, fwrite

    CSV <-- comma separated values, u need to use other comma or semicolon ...

      If using an earlier version of php....

      Here is a fputcsv function I created/modified that does it. In this application, I needed a tab delimited file, if you want CSV, change $fd to a comma...

      function fputcsv($handle, $row, $fd="\t", $quot='"')
      {
         $str='';
         foreach ($row as $cell) {
             $cell=str_replace(Array($quot,        "\n"),
                               Array($quot.$quot,  ''),
                               $cell);
             if (strchr($cell, $fd)!==FALSE || strchr($cell, $quot)!==FALSE) {
                 $str.=$quot.$cell.$quot.$fd;
             } else {
                 $str.=$cell.$fd;
             }
         }
      
         fputs($handle, substr($str, 0, -1)."\n");
      
         return strlen($str);
      }
        Write a Reply...