Reply
Forms/Output
Old 11-11-2004, 10:43 PM Forms/Output
Experienced Talker

Posts: 41
Hello:

I'm using fputs and script below to export information entered by in an online form. After each variable (for example: your name, your email, your message) I've placed a / sign. The information is saved in a text file.
As I open the text file in excel and defining the / as a divider/Delimiters the end results is that I am getting one line and each column has different data field.

YET, the problem is if a user in a text box for example like 'your message' is using the enter key, then we don't get a new line and it is hard to analyze the data and see which one is from which new user.
Is there a way that even users use the enter key I still get one line in excel?
How can I export this information in an elegant way to an excel sheet?

(Tried this dude - http://www.phpfreaks.com/tutorials/114/0.php didn’t get it)

Help!

Thank you. Grace.



<?php

$datesresult = '8ChoicesDatingResults.txt';
$fp = fopen( $datesresult, "a");

$fromname = $_POST['fromname'];
$fromemail= $_POST['fromemail'];
$friendsemail = $_POST['friendsemail'];
$message = $_POST['message'];
$SpreadTheLove = 'SpresdTheLove';
$end = "End";
$space = "/";

fputs($fp, $space);
fputs($fp, $SpreadTheLove);

fputs($fp, $space);
fputs($fp, $fromname);

fputs($fp, $space);
fputs($fp,$fromemail);

fputs($fp, $space);
fputs($fp, $friendsemail);

fputs($fp, $space);
fputs($fp, $message);


fputs($fp, $space);
fputs($fp, $end);

fclose($fp);

?>
grace04 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-12-2004, 12:28 AM
Gaffer Sports's Avatar
Ultra Talker

Posts: 397
Name: Steve
Location: Scotland
Why output to a text file and not a database that you can save as excel format later on?
__________________
Media Help & Discussion
Gaffer Sports is offline
Reply With Quote
View Public Profile Visit Gaffer Sports's homepage!
 
Old 11-12-2004, 12:45 AM
Republikin's Avatar
Super Moderator

Posts: 3,191
My initial guess is to try setting your textarea to WRAP=VIRTUAL. WRAP=VIRTUAL means that the text in the box wraps, but it is sent as one long continuous string.

If that doesn't work, we may have to try some fancy regex replacing. Each enter key should show up as \n on a linux server and \r\n on a windows server. In which case you could just replace all instances of \n with a space or some other thing that you want.
Republikin is offline
Reply With Quote
View Public Profile
 
Old 11-12-2004, 01:08 AM
Experienced Talker

Posts: 41
Quote:
Originally Posted by Gaffer Sports
Why output to a text file and not a database that you can save as excel format later on?
thank you for replaing.
I've only learned php a few weks ago do not know how to output those variables to a database
grace04 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Forms/Output
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12402 seconds with 12 queries