回 帖 发 新 帖 刷新版面

主题:一个简单的问题

要编一个学生调查表,并将学生填写的内容写入数据文件student.txt中,然后从student.txt中读取数据显示在网页上。而我只能分别把数据直接显示在网页上和读入文本中,而不能把它们连在一起。以下是我编的网页的代码,该怎样修改?
1.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>调查表</title>
<style type="text/css">
<!--
.style1 {
    font-size: large;
    font-weight: bold;
}
-->
</style>
</head>

<body>
<h2 align="center" class="style1">调查表</h2>
<hr>
<form action="5-2.asp" method="post">
<p>用户名:
  <input type="text" name="name" size="50"> 
</p>
<p>密码:
  <input type="password" name="pass" size="35">
</p>
<p>电子邮箱:
  <input type="text" name="mailbox" size="60">
</p>
<p>家庭住址:</p>
<p>  <input type="text" name="address" size="100">
</p>
<p>就读的院系:
  <input type="text" name="academic" size="55" >
</p>
<p> 个人爱好:
  <input type="checkbox" name="checkbox" value="跳舞">
  跳舞 
  <input type="checkbox" name="checkbox" value="唱歌">
唱歌 
<input type="checkbox" name="checkbox" value="打牌">
打牌 
<input type="checkbox" name="checkbox" value="阅读">
阅读</p>
<p>性别:
  <select name="select" size="1">
    <option selected>男</option>
    <option>女</option>
  </select>
血型:
<input type="radio" name="radiobutton" value="A">
A
<input type="radio" name="radiobutton" value="B">
B
<input type="radio" name="radiobutton" value="C">
AB
<input type="radio" name="radiobutton" value="D"> 
O
</p>
<p>
  <input type="submit" name="Submit" value="提交"> 
</p>
</body>
</html>

5-2.asp
<html>
<body>
<center><h2>
<p>你输入的用户名是:<%=Request.Form("name")%></p>
<p>你输入的密码是:<%=Request("pass")%></p>
<p>你输入的电子邮箱是:<%=Request.Form("mailbox")%></p>
<p>你输入的家庭地址是:<%=Request.Form("address")%></p>
<p>你就读的院系是:<%=Request.Form("academic")%></p>
<P>你的爱好是:<%=Request.Form("checkbox")%></p>
<p>你的性别是:<%=Request.Form("select")%></p>
<p>你的血型是:<%=Request.Form("radiobutton")%></p>
<p><%
dim objfile
dim objstream1
set objfile=Server.CreateObject("Scripting.FileSystemObject")
set objstream1=objfile.CreateTextFile(Server.MapPath("../test")&"\student.txt",true)
objstream1.write Request.Form("name")
objstream1.write Request.Form("pass")
objstream1.write Request.Form("mailbox")
objstream1.write Request.Form("address")
objstream1.write Request.Form("academic")
objstream1.write Request.Form("checkbox")
objstream1.write Request.Form("select")
objstream1.write Request.Form("radiobutton")
objstream1.close
set objstream1=nothing
set objfile=nothing
%></p>
</body>
</html>

回复列表 (共2个回复)

沙发

用数据库来做,比较好。

板凳

关于<%@ assembly Src="../code.cs" %>
我执行了这一句它说
无法使用向导..在顶级目录上.这是为什么?
我的c:\\inetpub\wwwroot\security\login.aspx
想调用c:\\inetpub\wwwroot\visual\code.cs

对标题的理解不是很清楚.希望能有人帮忙,先谢谢了.
其中../是什么意思啊??

我来回复

您尚未登录,请登录后再回复。点此登录或注册