Hi All,
I am very new to PHP and I need some help. I've got a multipage form that is made of up straight inputs and inputs that can be created dynamically, on the fly, so people can add in other jobs/degrees/awards.
When the user submits, I am trying to load the input results to a .csv file. For the input fields that are not dynamically created this is no problem, but for the ones that are, an I've got it generating an array of values. However, when I pass these values to the csv sheet each new array entry value is taking up the space next to it. Is it possible to have the first set of array values take up the requisite fields and then have the remaining values relative to that particular array section appear below, almost as if you put in a <br> tag?
PHP Code:
$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
$homeAddress = $_POST["homeAddress"];
$homeAddressTwo = $_POST["homeAddressTwo"];
$city = $_POST["city"];
$province = $_POST["province"];
$postalCode = $_POST["postalCode"];
$homePhone = $_POST["homePhone"];
$personalEmail = $_POST["personalEmail"];
$confirmEmail = $_POST["confirmEmail"];
$oectaNumber = $_POST["oectaNumber"];
$memberStatus = $_POST["memberStatus"];
$teacherTraining = $_POST["teacherTraining"];
$teachingYears = $_POST["teachingYears"];
$employmentHistory = $_POST["employmentHistory"];
$employmentHistoryValues = print_r(array_values($employmentHistory));
$csvdata = $firstName . ", " . $lastName . ", " . $homeAddress . ", " . $homeAddressTwo . ", " . $city . ", " . $province . ", " . $postalCode . ", " . $homePhone . ", " . $personalEmail . ", " . $confirmEmail . ", " . $oectaNumber . ", " . $memberStatus . ", " . $teacherTraining . ", " . $teachingYears . "," . $employmentHistoryValues;
$fp = fopen("formdata.csv", "a");
if($fp)
{
fwrite($fp, $csvdata . "\n");
fclose($fp);
}