Normally this is a semi-colon issue but not in this case. Cannot tell why this code isn't working and keeps generating
Parse error: syntax error, unexpected 'foreach' (T_FOREACH) in C:mywebdirectory\secure\OntCorpNFPNuansUpload.php on line 16
The data feeding it is just names, addresses and such - and no semi-colons there but its URL encoded anyways.
<?php
function sanitize_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
function printArray($array, $pad = '', $arrayName = '') {
foreach ($array as $key => $value) {
if (is_array($value)) {
printArray($value, '', $key);
} elseif (isset($value)) {
$myString = $value;
$myString = sanitize_input($myString);
if ($arrayName != "") {
echo $pad . "<input type=\"hidden\" id=\"$key\" name=\"" . $arrayName . "[$key]\" value=\"$myString\">";
} else {
echo $pad . "<input type=\"hidden\" id=\"$key\" name=\"$key\" value=\"$myString\">";
}
}
}
}
if(isset($_POST['NonProfitType'])) {
$NonProfitType = sanitize_input($_POST["NonProfitType"]);
} else {$NonProfitType = "";}
$postpath="";
if ($NonProfitType == "Charitable Corporation") {
$postpath="payment-nonprofit2b.php";
} else {$postpath="payment-nonprofit2.php";}
?>
It should just display the page with an upload form after this code but never gets that far.