still testing and have now got a small problem
It is storing the data in the csv file but its inputting the names of the headings
I know what part of the code it is to do with but how do I get the coding to store the information that the user puts in
The coding is below
[php]<?php
$fn = $_POST[‘fn’] = “First Name”;
$ln = $_POST[‘ln’] = “Last Name”;
$address = $_POST[‘address’] = “Address”;
$city = $_POST[‘city’] = “City”;
$fstate = $_POST[‘state’] = “State”;
$zip = $_POST[‘zip’] = “Zip”;
$phone = $_POST[‘phone’] = “Phone”;
$email = $_POST[‘email’] = “Email”;
$emailMe = $_POST[‘emailMe’] = “Email Me”;
$comments = $_POST[‘comments’] = “Comments”;
//validate
if(empty($fn) && empty($ln) && empty($address) && empty($city) && empty($state) && empty($zip) && empty($phone) && empty($email)) { /show the form/
$message = ‘Fill in areas in red!’; $aClass = ‘errorClass’;
} else {
/this is where the creating of the csv takes place/
$csvData = $fn . “,” . $ln . “,” . $address. “,” . $city. “,”. $fstate . “,” . $zip. “,”. $phone. “,”. $email . “,”. $emailMe . “,” .$comments ."\n";
$fp = fopen("formTest.csv","a");//$fp is now the file pointer to file $filename
if($fp){
fwrite($fp,$csvData);//write information to the file
fclose($fp); //close the file
}
}
?>
<?=$message;?> |
First Name |
|
Last Name |
|
|
City |
|
State |
|
Zip |
|
Phone |
|
Email |
|
|
Please send me email |
Comments
|
[/php]