Php form write to CSV file?

Hello,

I know some basic PHP, but never dealt with anything in regards to posting data.

We are emailing out an RSVP for an event that will collect basic information such as name, address, # of tickets etc. Would like to have this information stored in a CSV, then have them transfer to a thank you page afterwards. I know this probably isn’t super difficult, but I’m not sure where to start. Can someone point me in the right direction?

Thanks!

This kind of thing is sometimes better served by using a Google Docs Spreadsheet over the top of which you can create a form for your users to fill in.

You simply email them the link to the form, honestly, its laughably easy by comparison.

Stop sharing spreadsheets, start collecting information - Docs Blog

or [google]google docs spreadsheet form[/google]

you could do something like this (in it simplest form) when the form is posted


$csvFile = "myCSV.csv";
$fh = fopen($csvFile, 'w') or die("can't open file");
$stringData = $_POST['some_value'] .','. $_POST['so on'] "\
";
fwrite($fh, $stringData);


We are emailing out an RSVP for an event that will collect basic information such as name, address, # of tickets etc.

I read this to mean the OP wants to analyse the returning email, which is a whole other ball game.

But, yeah, could be emailing a link to a form on his/her own site which passes data to a csv handler …

Am I able to later embed this form into a stylized webpage? Or does this form have to reside within google docs

No, you can embed this within a normal webpage, uses an iframe IIRC.

Embed your forms - Docs Blog

I only suggested doing it this way because I got the impression you just want something that works, and is fast.

Someone will as likely help you with your progress to make this using PHP/csv if you wish to learn.

Hmm I think that will work, not sure if it gives you control over setting up a “thank you page”… Because after we collect the information, we need to redirect them to a page that has tickets that they can print out.

I would love to learn now to do the php/csv method, but don’t even know where to begin. I tried to google this but no luck.

Give this simple tutorial a go How to save web form data in a text file with PHP and come back with any questions.

This would work perfect, if only I could embed a link after the form is submitted. It does not accept HTML code :frowning: Any idea if there is a way around this?

looking into this now… thank you so much.