Posting Results in PHP

时间:2016-10-20 12:51:49

标签: php html excel forms csv

I am attempting to post the results gathered from a multipage form in a CSV sheet. The form itself is being difficult because it has a number of inputs that can be dynamically created so the user can add more data.

I was attempting to post to CSV sheet and I had it working but only vertically, it was stacking the results like so and only in the cell A spacing:

variable name => result
variable name => result.

This format is perfect, but is there a way I can get it to go horizontally across the page with each value in its own cell?

<?php
    //page one inputs
    $postResults = '';

    if (isset($_POST) && !empty($_POST))
    {
        $postResults = 'Post results: <pre>'.print_r($_POST,1).'</pre>';
    }

    $csvData = $postResults;
    $fp = fopen("formdata.csv", "a");

    if($fp)
    {
        fwrite($fp, $csvData . "\n");
        fclose($fp);
    }
?>

0 个答案:

没有答案