How do i store valid form inputs in a csv file? I am not sure how to start, but I know that php and mysql is involved.

Recommended Answers

All 7 Replies

You don't need MySQL to store data in a CSV, if you are using CSV for storing data rather than reporting on or exporting data, then I would have to wonder why you aren't just storing it in MySQL.

The function you need is fputcsv, plently of examples on google.

I was researching and I noticed an fopen function, is that any good?

fopen gives you a handle to a file, you then need to use another function (Such as fwrite, fputcsv...) to put data into the file.

use explode() and fputscv(). if it's from an input use while loop or any other looping statement which ever you prefer and store it in an array. use explode() and foreach() for fputcsv() this was my problem also last year, but through extensive "googling" and brain storming my own brain. i finally figure out the answer.

I am going to look into that, by any chance do you still have the source code that you used in solving this question a year ago?

I was told to look into fputcsv but i didn't realize explode was needed... Well good thing I'm still learning :)

I made a typo here:

I was told to look into fputcsv but...

It should've been fputscv :)

Okay, so I have attempted a few things but I can't get it to work... Can you guys write me a sample snippet?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.