In survey.html, I need people input their ID and comment.
In Mysql, I've already made the survey table.
I use survey_result.php to import people's input to that table in Mysql.
Then I use survey_file.php to get data in Mysql into a survey.txt file.
Later I use Excel to open this .txt file.
My problem is, if more than one paragraph entered in "comment" field in survey.html, like:
good,
very good!
ok!
the last two paragraphs appeared in the first column (ID) in the survey.txt file.
But what I expect is they be in the 2nd (i.e., comment) column; and when I use Excel to open the .txt file, all these three paragraphs should be in one cell in the comment column.
Below are the key codes/descriptions:
Expand|Select|Wrap|Line Numbers
- "survey.html"
- <input type="text" size="30" name="ID">
- <TEXTAREA NAME="Comment" ROWS=18 COLS=50></TEXTAREA>
- "survey table in mysql"
- Field Type Null Key Default Extra
- id char(2) YES NULL
- comment text YES NULL
- "survey_result.php"
- $query = "insert into bar values
- ('".$id."','".$comment."')";
- "survey_file.php"
- $fp = fopen("survey.txt", 'wb');
- $row = $result->fetch_assoc();
- fprintf ($fp, "%s\t%s\n",$row['id'], $row['comment']);
- "survey.txt"
- ID Comment
- 15 good,
- very good!
- ok!