Jump to content

PHP5 - PHP Form & .csv file as DB


Menax

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/239045-php5-php-form-csv-file-as-db/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.