문제

How can I make a radio button checked based on the database value in ASP Classic using a MS Access database? For example, when I insert into database using radio button like Gender, if I selected Male how can I retrieve the the Male checked in radio button?

This is the code I used:

Gender:
<label><input type="radio" name="gend" value="Male" id="male">Male</label>
<label><input type="radio" name="gend" value="Female" id="female">Female</label>

I also use this in retrieving values from database:

<% =rs.fields("emp_gender") %>

Please help me to achieve this. Thanks in advance.

올바른 솔루션이 없습니다

다른 팁

<%
public function iif(i, j, k)
    if i then iif = j else iif = k
end function

%>
<label><input type="radio" name="gend" value="Male" id="male" <%=iif(rs.fields("emp_gender")="Male", "checked", "")%>>Male</label>
<label><input type="radio" name="gend" value="Female" id="female" <%=iif(rs.fields("emp_gender")="Female", "checked", "")%>>Female</label>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top