我有一个 html 表单并使用 get 方法
如果用户选择鞋子选项值,我想将数据输入到 shoes_sales.txt,并将其余所有输入到衣服_sales.txt。
我正在使用以下 if 语句
<?php
header("Location: thankforsumbitting.html");
if($_GET['variable1'] == "shoes" || $_GET['variable1'] == "shoes"){
$handle = fopen("shoes_sales.txt", "a");
foreach($_GET as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
}
else {
$handle = fopen("clothes_sales.txt", "a");
foreach($_GET as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
fclose($handle);
exit;
?>