473,385 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

radio button help

1
Hi,

I am new to asp and developing a quiz portal.

I need a help for this.

I am using MS Access database which is having a table called 'Quiz_Master' having fields such as 'Quiz_id', 'Quiz_Name', 'Quiz_Date','IsCurrent','Deleted'.

Here is my requirement:
1. I want a page where there will be radio buttons whose value will come from the above table showing all the list of 'Quiz_Name'.
2.The user will select one of the above quiz names and the 'IsCurrent' value for that particular quiz will be set to '1' in the database.

Please help me in this regard as soon as possible.

Thanks in advance
Sep 24 '07 #1
1 1316
shweta123
692 Expert 512MB
Hi,

Here is the example code how you can do it,
Expand|Select|Wrap|Line Numbers
  1. <%
  2.  
  3. Dim con
  4. Dim rs
  5. Dim sql
  6.  
  7. con = Server.createObject("Adodb.Connection")
  8. rs = Server.createObject("Adodb.Recordset")
  9.  
  10. con.connectionString ="..."
  11.  
  12. 'Open connection
  13. con.open
  14.  
  15.  
  16. 'Select data from your table
  17. sql = "Select * from Quiz_Master"
  18. set rs = con.Execute(sql)
  19.  
  20.  
  21. 'Fill the radioButtons with the values from the table
  22.  
  23. while not rs.Eof%>
  24.  
  25. <Input type ="radio" name ="radiobutton" value ="<%=rs.fields("Quiz_Name")">
  26.  
  27. <%rs.movenext
  28.  
  29. wend%>
  30.  
  31.  
  32. Now , after submitting the page get the values of the radioButtons
  33.  
  34. <%
  35.  
  36. Dim x
  37.  
  38. For each x in Request.Form
  39.  
  40.  
  41.    If x.name = ="radiobutton"  then
  42.  
  43.     'Update database
  44.     sql ="Update Quiz_Master set isCurrent =1 where Quiz_Name ='" &  x & "' "
  45.    end if
  46.  
  47. Next
  48.  
  49. %>
Hi,

I am new to asp and developing a quiz portal.

I need a help for this.

I am using MS Access database which is having a table called 'Quiz_Master' having fields such as 'Quiz_id', 'Quiz_Name', 'Quiz_Date','IsCurrent','Deleted'.

Here is my requirement:
1. I want a page where there will be radio buttons whose value will come from the above table showing all the list of 'Quiz_Name'.
2.The user will select one of the above quiz names and the 'IsCurrent' value for that particular quiz will be set to '1' in the database.

Please help me in this regard as soon as possible.

Thanks in advance
Sep 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with...
2
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and...
3
by: Amelyan | last post by:
When we want radio button to belong to a group name we say, radio1.GroupName="GroupA". In this case, radio1 will be unselected if another radio button is selected in "GroupA". Is there a way...
2
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put...
1
by: Jerry | last post by:
We have a 10-question quiz for kids, each question being a yes or no answer using radio selections. I'd like to keep a current total of yes's and no's at the bottom of the quiz (if the user selects...
1
by: kenny8787 | last post by:
Hi, can anyone help here? I have the following code generated from a database, I want to have javascript calculate the costs of the selected items using radio buttons, subtotal the costs and...
5
by: swatidesai0407 | last post by:
hi im validating radio buttons i create dis radio button in php based on some how many records of my query. i wrote a javascript to validate this buttons. wat i do is dat wen no radio button...
3
by: jahphill | last post by:
Hey. I thought id make a seperate discusion because the other became a bit lengthy and confusing. Aim: Create a php file which works with the script below, which makes the radiobuttons work =D...
8
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
11
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.