CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 2347|Reply: 1

Radio Button Checked using ASP

[Copy link]
Post time 17-4-2009 10:58 AM | Show all posts |Read mode
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....
Reply

Use magic Report


ADVERTISEMENT


Post time 17-4-2009 11:37 PM | Show all posts

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...
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

10-1-2025 04:55 AM GMT+8 , Processed in 0.046858 second(s), 15 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list