Current location: Hot Scripts Forums » Programming Languages » PHP » CSV File


CSV File

Reply
  #1 (permalink)  
Old 09-24-06, 07:19 PM
Andy128 Andy128 is offline
Wannabe Coder
 
Join Date: Jun 2006
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
CSV File

I have a php script that will collect info from a form and put it in a CSV file on the server. The file is listed below;
PHP Code:

<?php

@extract($_POST);
if(
is_writable('emails.csv'))
{
$fp fopen('emails.csv','a');
//Content equals the fields in the form
$content "$lastname,$firstname,$email,$format,$date\n";
fwrite($fp,$content);
fclose($fp);
echo
" Thanks- your info has been logged!";
}
else
{
echo
'File is not writable';
}
?>
Once I create the Column Headers- how do I tell it to start the in put from
the form on the second line?

Hope that is clear enough.

Andy
Reply With Quote
  #2 (permalink)  
Old 09-25-06, 02:53 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
you mean add data to a second line in a script?
PHP Code:

$fp fopen("emails.csv""a");

fwrite($fp$content); 
and i quote php.net:
Quote:
Originally Posted by php.net
'a' => Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
If this is not what you mean, please explain your problem a little more. or give an example
Greetz,
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload a file to a fix web folder of a website without using FTP software sujata_ghosh Perl 4 05-10-06 09:10 AM
Error message not getting displayed. sanjeet Windows .NET Programming 0 12-20-05 10:48 AM
CSV file..how to?? goldbidders The Lounge 0 01-11-05 07:47 AM
Getting the created file (fopen/fwrite) Programme PHP 5 02-14-04 03:09 PM
Upload file type and size limiter! Arctic ASP 1 08-02-03 07:06 PM


All times are GMT -5. The time now is 05:40 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.