View: 2347|Reply: 1
|
Radio Button Checked using ASP
[Copy link]
|
|
Salam....
Saya ada masalah macam mana nak buat coding guna asp utk radio button.
Saya ada page senarai nama peserta yg diambik dari db dan lepas tuh ada radio button utk column kehadiran bagi memudahkan user utk tick sapa yg hadir dan tak. kat sini saya ada paste coding....
<%
if Request.Form("txtHSave") = "edit" then
txtid = Request.Form ("txtHid")
txtjenis = Request.Form("selectjeniskehadiran")
sqlstring = "exec mp_updatekehadirankursus '" & txtid & "','"&txtjenis&"'"
SET AdoLocal = AdoConLocal.Execute(sqlstring)
%>
<script language=javascript>
alert ("DATA BERJAYA DIKEMASKINI")
window.location.href="pengesahan_kehadiran.asp"
</script>
%>
<form name="frmupdate" id ="frmupdate">
<td width="21%"><div align="center">
<input type="radio" name="radiobutton" value="Y">
<font color="#000000" size="2" face="Geneva, Arial, Helvetica, sans-serif">HADIR</font></div></td>
<td width="27%"><div align="center"> </FONT>
<input type="radio" name="radiobutton" value="N">
<font color="#000000" size="2" face="Geneva, Arial, Helvetica, sans-serif">TIDAK HADIR </font></div>
</td>
</form>
....so mintak otai2 kat sini tlg saya apa yg perlu saya buat dan letak kat mana.... |
|
|
|
|
|
|
|
Balas #1 lady_lily\ catat
Ni ASP bese je kn ?? yg sblm zaman asp.net lg kn ?? kalau benar...solution dia cm kt bawah ni...based on ur coding la ni sume ni...
<%
dim attendance
attendance=Request.Form("radiobutton")
if Request.Form("txtHSave") = "edit" then
txtid = Request.Form ("txtHid")
txtjenis = Request.Form("selectjeniskehadiran")
sqlstring = "exec mp_updatekehadirankursus '" & txtid & "','"&txtjenis&"'"
SET AdoLocal = AdoConLocal.Execute(sqlstring)%>
<script language=javascript>
alert ("DATA BERJAYA DIKEMASKINI")
window.location.href="pengesahan_kehadiran.asp"
</script><%
end if
%>
<form name="frmupdate" id ="frmupdate">
<td width="21%">
<div align="center">
<input type="radio" <%if attendance="Y" then Response.Write("checked")%> name="radiobutton" value="Y" />
<font color="#000000" size="2" face="Geneva, Arial, Helvetica, sans-serif">HADIR</font>
</div>
</td>
<td width="27%">
<div align="center">
<input type="radio" <%if attendance="N" then Response.Write("checked")%> name="radiobutton" value="N" />
<font color="#000000" size="2" face="Geneva, Arial, Helvetica, sans-serif">TIDAK HADIR </font>
</div>
</td>
</form>
*p/s: coding ni standard lama...tag yg da deprecated pun ada...try pakai css...utk label pakai tag utk ganti tag yg da deprecated tu... |
|
|
|
|
|
|
| |
|