Joe*_*Joe 4 php forms user-input input
作为订阅者获取的一部分,我希望从html表单中获取用户输入的数据,并使用php将其写入制表符分隔的文本文件.所写的数据需要通过制表符分隔并附加在其他数据下方.
单击表单上的订阅后,我希望它删除表单并在div中显示"感谢订阅"等小消息.
这将在wordpress博客上,并包含在弹出窗口中.
以下是具体细节.任何帮助深表感谢.
变量/输入是
$Fname = $_POST["Fname"];
$email = $_POST["emailPopin"];
$leader = $_POST["radiobuttonTeamLeader"];
$industry = $_POST["industry"];
$country = $_POST["country"];
$zip = $_POST["zip"];
Run Code Online (Sandbox Code Playgroud)
$ leader是一个双选项单选按钮,其中"是"和"否"为值.
$ country是一个下降的40个左右的国家.
所有其他值都是文本输入.
除了操作之外,我已经完成了所有基本的表单代码并准备就绪,我真正需要知道的是:
如何使用php写入制表符分隔的文本文件,并在提交感谢信息后换出表单?
再次感谢所有的帮助.
Eri*_*rik 10
// the name of the file you're writing to
$myFile = "data.txt";
// opens the file for appending (file must already exist)
$fh = fopen($myFile, 'a');
// Makes a CSV list of your post data
$comma_delmited_list = implode(",", $_POST) . "\n";
// Write to the file
fwrite($fh, $comma_delmited_list);
// You're done
fclose($fh);
Run Code Online (Sandbox Code Playgroud)
在impode中用\ t替换标签
| 归档时间: |
|
| 查看次数: |
30425 次 |
| 最近记录: |