email - PHP processing large form -
i having difficulty in saving post data csv file , emailing values address. have on 125 post variables , im quite stuck. here sample of code far:
<?php $x23 = "date"; $x24 = "fclose"; $x25 = "fopen"; $x26 = "fwrite"; $x27 = "mail"; $x28 = "time"; extract($_post); $a1 = $_post['fname']; $a2 = $_post['lname']; $a3 = $_post['email']; $a4 = $_post['landline']; $a5 = $_post['mobile']; $a6 = $_post['addr1']; $a7 = $_post['addr2']; $a8 = $_post['towncity']; $a9 = $_post['postcode']; $x1d = $a1 . "," . $a2 . "," . $a3 . "," . $a4 . "," . $a4 . "," . $a5 . "," . $a6 . "," . $a7 . "," . $a8 . "," . $a9 . " "; $quotation = $x25("file5.csv", "a"); $x26($x1d, $quotation); $x24($x1d); header('location: mydomain.co'); $x20 = 'mail@mydomain.com'; $x22 = 'quotation - company'; $x27($x20, $x21, $x23, $x1f); ?>
i have not put variables in question (not sure how this, think fputcsv() job, save 125 variables being written, iv'e never used php , not sure on arrays , fputcsv()).
how loop through post variables , append them csv 1 row?
any appreciated.
the function you're looking implode
. implodes array single string specific "glue", in case ','.
so, simplest way use implode(',', $_post)
, in case not of values supposed used, there's nice way handle changing names of form elements.
in form, if change name "fname"
"data[fname]"
, same rest of elements, $_post['data']
array holds of values. using implode(',', $_post['data'])
make sure desired values used.
Comments
Post a Comment