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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.