I am submitting from a form to a script that writes a siple csv file. ( easy ).
but....
I need to add variables to the file that are not sent from the form. for security I can't add them in a hidden. so my question is, how do I add variables after the form has been submited?
The I am using is:
Code: Select all
<?php
// Write to File
$string='$coname,$contact,$phone,$state,$qty,$reprogrammed,$teletraining,$terminal_aps,$yes_no,$if_yes,$initials,$date,$address,$repname,$status';
$filename = \"files/$repname.$coname\";
//echo\"$filename\";
if(file_exists($filename . \".csv\")) {
echo \"<meta http-equiv=\"refresh\" content=\"0;URL=error.php\">\";
//break;
} else {
$myVars = split (\",\", $string);
foreach ($myVars as $str){
$newString .= \",\" . @$_POST[substr(\"$str\", 1)];
$newString=stripslashes($newString);
$newString= strtoupper($newString);
}
$file = \"files/$repname.$coname.csv\";
$fp = fopen(\"$file\",\"a+\") or die (\"Issues\");
fputs($fp, $newString);
fclose($fp);
?>If anyone could help I would greatly apreciate it.
Wes/