Dreamweaver 中,如何使点击提交按钮,文本框1 和文本框2 的内容保存到一个txt中?
1个回答
2013-08-31
展开全部
<!-----我只会点php,给你用php写个简易的~~------>
<form action="" method="post">
账号:<input type="text" name="user" value="">
密码:<input type="password" name="password" value="">
<input type="submit" name="submit" value="提交">
</form>
<?php
if(isset($_POST['submit'])){
$user=$_POST['user'];
$paw=$_POST['password'];
$txt= $user.$paw."\r\n";
$tmp=fopen("1.txt",'a+') or die("打开文件1.txt失败!");
fwrite($tmp,$txt) or die("写入文件1.txt失败!");
echo "已保存!";
fclose($tmp);
}
?>
<form action="" method="post">
账号:<input type="text" name="user" value="">
密码:<input type="password" name="password" value="">
<input type="submit" name="submit" value="提交">
</form>
<?php
if(isset($_POST['submit'])){
$user=$_POST['user'];
$paw=$_POST['password'];
$txt= $user.$paw."\r\n";
$tmp=fopen("1.txt",'a+') or die("打开文件1.txt失败!");
fwrite($tmp,$txt) or die("写入文件1.txt失败!");
echo "已保存!";
fclose($tmp);
}
?>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询