0
간단한 프로그램에 관해 질문하고 싶습니다. 6 개의 텍스트 상자 (a, b, c, a1, b1, c1)가 있습니다. 입력 내용이 1,2,3,4,5,6 인 경우 txt 문서에는 처음 세 개의 숫자 1,2,3 (a, b, c) 만 표시됩니다.텍스트 상자의 데이터를 txt 파일에 게시
이 문제를 해결하는 방법을 알고 계십니까?
A1, B1, C1 c를,
A, B, 아래 그림과 같이 내가 txt 파일을 만들고 싶습니다
내 코드는 다음과 같습니다
<!DOCTYPE html><html>
<center>
<form method="post">
a: <input type="text" name="a">, b: <input type="text" name="b">, c: <input type="text" name="c"><br>
a1: <input type="text" name="a1">, b1: <input type="text" name="b1">, c1: <input type="text" name="c1"><br><br><br>
<input type="submit" value="Submit">
</form>
<?php
$txt = "data.txt";
if (isset($_POST['a']) && isset($_POST['b']) && isset($_POST['c']))
$fh = fopen($txt, 'a');
$txt=$_POST['a'].','.$_POST['b'].','.$_POST['c'];
fwrite($fh,$txt);
}
elseif (isset($_POST['a1']) && isset($_POST['b1']) && isset($_POST['c1']))
$fh = fopen($txt, 'a');
$txt=$_POST['a1'].','.$_POST['b1'].','.$_POST['c1'];
fwrite($fh,$txt);
fclose($fh);
}
?>
</center></body></html>
이 매우 감사합니다 George
친애하는 Daniel, 답장을 보내 주셔서 감사합니다. 이 문제를 해결합니다. – user3231730