SwishTalk.com
 

Go Back   SwishTalk.com > .:: THE HELP DESK ::. > » HTML and Backend Scripting

Reply
 
Thread Tools Display Modes
#1   Write to a new line in a text file from PHP  

Name: 
jasonwood
Status: Offline
Rank: Registered User
Posts: 32
Old 07-22-2005, 08:02 AM Reply With Quote


Hi, i need a little help!

Visitors to my site enter their name / email and this info is sent to a text file via a small PHP script.

However, i want the info in this format in the text file:

name
email

name
email etc...

At the moment they are just all joined together on a single line.
The script i have is:
Quote:
<?php
$email = $_POST['themail'];
$user = $_POST['thename'];

$count = $email."/n".$user."/n";

$file = fopen("count.txt", "a");
fputs($file, "$user\n");
fputs($file, "$email\n");
fclose($file);
?>
I added the \n after reading another post on here but it still write all the entires to the same line.

Any ideas? Thanks in advance!!




               
 
View Public Profile Send a private message to jasonwood Visit jasonwood's homepage! Find all posts by jasonwood Add jasonwood to Your Contacts
#2    
 
DPC's Avatar

Name: 
DPC
Status: Offline
Rank: Registered User
Posts: 2,232
Mood: Going up?
Old 08-04-2005, 04:23 AM Reply With Quote


thy this

<?php
$email = $_POST['themail'];
$user = $_POST['thename'];

$count = $email."/n".$user."/n";

$file = fopen("count.txt", "a");
fputs($file, "$user
$email
");
fclose($file);
?>
or

<?php
$email = $_POST['themail'];
$user = $_POST['thename'];

$count = $email."/n".$user."/n";

$file = fopen("count.txt", "a");
fputs($file, "$user\r\n");
fputs($file, "$email\r\n");
fclose($file);
?>
heers patrick


               
 
View Public Profile Visit DPC's homepage! Find all posts by DPC Add DPC to Your Contacts
#3   swish & php  

Name: 
calvin_lawrence
Status: Offline
Rank: Registered User
Posts: 3
Old 08-04-2005, 09:21 AM Reply With Quote


I'm trying to do the following:
Read from a txt file
Use the value from a swish textbox to search the data from the file.
Place the search results in a swish text file.

The content of the text file is
JohnDoe 45 1993 russia
derickJ 43 1984 usa
donnie 55 1834 spain

Thanks,
I'm new to swish and new to PHP...If you could send me some text code and a test .swi file, I would be internally indebted to you..

Please send to my email at,
calvinl@us.ibm.com




               
 
View Public Profile Send a private message to calvin_lawrence Find all posts by calvin_lawrence Add calvin_lawrence to Your Contacts
#4    
 
DPC's Avatar

Name: 
DPC
Status: Offline
Rank: Registered User
Posts: 2,232
Mood: Going up?
Old 08-04-2005, 01:31 PM Reply With Quote


here is a basic example was a guestbook from Tisse

Cheers Patrick


Attached Files
File Type: zip linefeed.zip (25.6 KB, 162 views)
               
 
View Public Profile Visit DPC's homepage! Find all posts by DPC Add DPC to Your Contacts
#5    

Name: 
big.z
Status: Offline
Rank: Registered User
Posts: 243
Old 06-16-2006, 03:31 AM Reply With Quote


just trying to do something similar. Will the text file be fixed format for the field lengths. I want something that can later be used for a mail merge or something similar.

Thanks in advance


               
 
View Public Profile Send a private message to big.z Find all posts by big.z Add big.z to Your Contacts
Advertisement:





Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump