标题:找大虾们帮忙,小弟在此谢过!
只看楼主
shuitu2011
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2011-10-6
结帖率:66.67%
已结贴  问题点数:13 回复次数:1 
找大虾们帮忙,小弟在此谢过!
使用request返回调查表中输入的东西,才学没多久不知道怎么做了,请高手指点!谢谢!
调查表中aspx代码为:
<html xmlns="http://www. >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server" action="output.aspx" method="post">
        <table style="width: 457px; height: 361px; background-color: lightblue;",border="1",align="center" >
            <tr>
                <td >
                <h2 style="text-align:center">调查表</h2>
                <hr style="size:inherit"/>
                    用&nbsp; 户 名:<input id="Text1" runat="server" name="love" type="text" style="width: 155px" /><br />
                    输入密码:<input id="Password1" runat="server" name="love" type="password" style="width: 155px" /><br />
                    密码校对:<input id="Password2" runat="server" name="love" type="password" style="width: 155px" /><br />
                    真实姓名:<input id="Text2" runat="server" name="love" type="text" style="width: 155px" /><br />
                    电子邮箱:<input id="Text3" runat="server" name="love" type="text" style="width: 155px" /><br />
                    住址:<input id="Text4" runat="server" name="love" type="text" style="width: 155px" /><br />
                    院系:<input id="Text5" runat="server" name="love" type="text" style="width: 155px" /><br />
                    留言:<br />
                    <textarea id="TextArea1" runat="server" cols="60" name="love" rows="4"></textarea><br />
                    所在城市:<select id="Select1" runat="server" name="love" size="1">
                        <option selected="selected">北京市</option>
                        <option>郑州市</option>
                        <option>南昌市</option>
                        <option>海口市</option>
                        <option>昆明市</option>
                        <option></option>
                    </select><br />
                    个人爱好:<input id="Checkbox1" runat="server" name="love" style="width: 17px; height: 18px;" type="checkbox" value="足球" />
                    足球
                    <input id="Checkbox2" name="love" type="checkbox" value="乒乓球" />
                    乒乓球
                    <input id="Checkbox3" name="love" type="checkbox" value="绘画" />
                    绘画
                    <input id="Checkbox4" name="love" type="checkbox" value="音乐" />
                    音乐
                    <input id="Checkbox5" name="love" type="checkbox" value="唱歌" />
                    唱歌
                    <input id="Checkbox6" name="love" type="checkbox" value="围棋" />
                    围棋<br />
                    性别:<input id="Radio1" name="love" type="radio" value="男" />
                    男
                    <input id="Radio2" name="love" type="radio" value="女" />
                    女<br />
                    血型:<input id="Radio3" name="love" type="radio" value="A" />
                    A<input id="Radio4" name="love" type="radio" value="B" />
                    B
                    <input id="Radio5" name="love" type="radio" value="AB" />
                    AB
                    <input id="Radio6" name="love" type="radio" value="C" />
                    O<br />
                    <input id="Submit1" type="submit" value="提交" /></td>
            </tr>
        </table>
   
    </form>
</body>
</html>
用来显示的页面的aspx代码为:
<html xmlns="http://www. >
<head runat="server">
    <title>无标题页</title>
</head>
<body style="background-color:skyblue">
    <form id="form1" runat="server">
    <div>
    <p style="text-align:center"><b style="color:Red">你提交的调查表内容如下所示:</b></p>
    </div>
    <%
        NameValueCollection coll = Request.Form;
        string[] arr1 = coll.AllKeys;
        string[] arr2 = coll.GetValues(arr1[0]);
        Response.Write("用户名为:"+arr2[0]+"<br/>");
        arr2 = coll.GetValues(arr1[1]);
        Response.Write("第一次输入密码为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[2]);
        Response.Write("第二次输入密码为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[3]);
        Response.Write("真实姓名为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[4]);
        Response.Write("电子信箱为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[5]);
        Response.Write("你的住址为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[6]);
        Response.Write("你的院系为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[7]);
        Response.Write("你的留言为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[8]);
        Response.Write("你所在的城市为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[9]);
        Response.Write("你的爱好为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[10]);
        Response.Write("你的性别为:" + arr2[0] + "<br/>");
        arr2 = coll.GetValues(arr1[11]);
        Response.Write("你的血型为:" + arr2[0] + "<br/>");
        %>
    </form>
</body>
</html>
搜索更多相关主题的帖子: request server action 
2011-11-10 20:20
yms123
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:13 
Request返回需要借助name属性
比如
<input name="userName" type="text" runat="server" />用户名
获取时就可以
string usName=Request.Form["userName"];
Response.Write("用户名为:"+usName);
2011-11-11 13:06



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-354890-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.415071 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved