Menax Posted June 11, 2011 Share Posted June 11, 2011 Hey Guys, I have a php form which writes on a .csv file and works fine. I want to add the following feature: Every time somebody submits the form then the first column on the csv file will take an increasing number +1. The process should be like this: Click submit button => read on .csv the last line with text of first column => add +1 to this number and record it on the .csv => send email to the user with this value. It will be sth like protocol number. I have limited knowledge on PHP. The current write2csv and send email code is the following: if($fp = fopen('file.csv', 'a')) { fputcsv($fp, $list, ';'); fclose($fp); mail("$email",'=?UTF-8?B?'.base64_encode($subject_ep).'?='.'=?UTF-8?B?'.base64_encode($subject).'?=',"$replymessage","From: $replyemail1\r\nReply-To: $replyemail1\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Transfer-Encoding: 8bit\r\n\r\n"); echo $success_sent_msg; }else { echo "fail"; } ?> Where $list is an array with all the variables. Any assistance is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/239045-php5-php-form-csv-file-as-db/ Share on other sites More sharing options...
wildteen88 Posted June 11, 2011 Share Posted June 11, 2011 Can give use some sample data to work with that is stored in the .csv Quote Link to comment https://forums.phpfreaks.com/topic/239045-php5-php-form-csv-file-as-db/#findComment-1228308 Share on other sites More sharing options...
Menax Posted June 11, 2011 Author Share Posted June 11, 2011 I attach the data.csv The last column a/a will save an increasing number each time a user clicks on submit. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/239045-php5-php-form-csv-file-as-db/#findComment-1228361 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.