asp代码添加用户这样可以吗?

来源:百度知道 编辑:UC知道 时间:2024/09/22 19:27:42
<form id="form1" name="form1" method="post" action="insert">
<table width="00" border="0" align="center">
<tr>
<td colspan="2"><div align="center" class="STYLE1">注册新用户:</div></td>
</tr>
<tr>
<td width="150"><div align="right"><span class="STYLE2">账 号:</span></div></td>
<td width="257"><label>
<input name="username" type="text" id="username" />
</label></td>
</tr>
<tr>
<td><div align="right"><span class="STYLE2">密 码:</span></div></td>
<td><label>
<input name="password"

你的表单头
<form id="form1" name="form1" method="post" action="insert">
里面的action不对
应该是
<form id="form1" name="form1" method="post" action="?action=insert">

还有你写的SQL语句
应该为 sql="insert into user(username,password,sex,birthday,interest) values('"&uesrname&"','"&password&"','"&sex&"','"&birthday&"','"&interest&"')"

<%

'提交后最好写到最上边 这样节省资源 不用再读下方FORM表单里的东西
if trim(request.QueryString("action"))="insert" then
username=trim(request.form("password"))
password=trim(request.form("username"))
sex=trim(request.form("sex"))
birthday=trim(request.form("birthday"))
interest=trim(request.form("interest"))
sql="insert into user (username,passw