Forum Moderators: coopster
Having had help to figure out pulling data from a CSV into a HTML form now I need to take the info and save it to another CSV file. I have written some code for it. As far as I can tell it opens the file and I know that it is getting the $_Post variables but it will not add the data to the CSV?
<?
if(!$fp = fopen("calls.csv", "r")){
die ("Cannot open data file");
} else {
print 'Connected to CSV';
}
$writetocsv= $_POST['NBSCRef'] . "," . $_POST['NBSCName'] . "," . $_POST['CallTaker'] . ","
. $_POST['ManualRef'] . "," . $_POST['DateLogged'] . "," . $_POST['TimeLogged'] . "," .
$_POST['FAD'] . "," . $_POST['SiteName'] . "," . $_POST['CallerName'] . "," .
$_POST['Position'] . "," . $_POST['Address'] . "," . $_POST['City'] . "," . $_POST['State']
. "," . $_POST['Zip'] . "," . $_POST['PhoneNumber'] . "," . $_POST['CallType'] . "," .
$_POST['ProblemType'] . "," . $_POST['Severity'] . "," . $_POST['Priority'] . "," .
$_POST['NoofCounters'] . "," . $_POST['NodeAffected'] . "," . $_POST['ProblemDescription'] .
"," . $_POST['Action1'] . "," . $_POST['Action2'] . "," . $_POST['Action3'] . "," .
$_POST['Action4'] . "," . $_POST['Action5'] . "," . $_POST['Action6'] . "," .
$_POST['Action7'] . "," . $_POST['Action8'] . "," . $_POST['Action9'] . "," .
$_POST['Action10'] . "," . $_POST['AccessTimes'] . "," . $_POST['NodeStatus'] . "," .
$_POST['Recommend'] . "," . $_POST['Spares1'] . "," . $_POST['Spares2'] . "," .
$_POST['Spares3'] . "," . $_POST['Spares4'] . "," . $_POST['Spares5'];
fwrite($fp,$writetocsv);
fclose($fp);
?>