getery 发表于 2008-7-2 13:36

怎样将数据库中单选按钮的值影射在页面单选按钮上 ???????急急急

存储在数据库中的单选按钮的值,我存在数据库中存的是0和1,怎样在页面上用单选按钮表示数据库中已选择和未选择??????

getery 发表于 2008-7-2 15:05

难道就没人知道吗?

madpbpl 发表于 2008-7-2 15:12

<input type="radio" name="r_name" <%if value=数据库的字段值 then Response.Write "checked" end if%>value值

getery 发表于 2008-7-2 15:58

楼上的朋友,还是不行啊。

我在数据库里,将radio button的值的格式设为文本的形式。

程序中radio button的代码如下:

<input type=radio name=right value="<% if value="是" then response.write "checked" end if%>">管理权限
<input type=radio name=right value="<% if value="否" then response.write "checked" end if%>">一般权限

当我想通过修改页面修改用户的信息时,radio button仍然没有被选中

madpbpl 发表于 2008-7-2 16:11

你存的值是“是和否”还是“1和0”呢?

madpbpl 发表于 2008-7-2 16:16

不好意思,是我前面写错了
<input type=radio name=right value="是" <% if rs("right")="是" then response.write "checked" end if%>">管理权限

<input type=radio name=right value="否" <% if rs("right")="否" then response.write "checked" end if%>">一般权限

getery 发表于 2008-7-2 16:26

不好意思。我没写清楚。
首先:
form_right=rs("是否管理员")    '//从数据库的“是否管理员”column中取值

我存的值是“是”和“否”

然后:
<input type=radio name=right value="<% if form_right="是" then response.write "checked" end if%>">管理权限

<input type=radio name=right value="<% if form_right="否" then response.write "checked" end if%>">一般权限

但是在编辑用户信息页面,仍然无法让radio button显示出该用户是否为管理员

tianyu123 发表于 2008-7-2 17:17

<input type=radio name=right [color=Red]value[/color]="<% if form_right="是" then response.write "checked" end if%>">管理权限

<input type=radio name=right [color=Red]value[/color]="<% if form_right="否" then response.write "checked" end if%>">一般权



[color=Blue]你要做的是是否选中,而不是value等于checked[/color]

madpbpl 发表于 2008-7-2 19:19

form_right=rs("是否管理员")
<input type=radio name=right value="是" <% if form_right="是" then response.write "checked" end if%>">管理权限

<input type=radio name=right value="否" <% if form_right="否" then response.write "checked" end if%>">一般权限

linux_hj 发表于 2008-7-2 21:55

[quote][bo][un]madpbpl[/un] 在 2008-7-2 19:19 的发言:[/bo]

form_right=rs("是否管理员")
[/quote]
这样写的话还是有问题哦。后面多了个"

页: [1]

编程论坛