|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
i am tryign to print a table with values from db using radio buttons. what is happening is the heading is getting repeated as many records i have and also my radio button is falling under my 1st column of a table whereas i want it outside my table...extreme left ....its a simple prob ... but struggling up and down since past 30 mins
any suggestions? thanks in advance! My code: <% DIM SQL DIM RSA DIM RSA2 DIM BGC dim iCount iCount = 0 set RSA = Server.CreateObject("ADODB.Recordset") RSA.OPEN "SELECT sc.student_id,st.story_name,si.student_name,sc.story_id, sc.status_student FROM student_content sc, student_info si, story_table st where (sc.student_id = si.student_id and sc.story_id = st.story_id)", "DSN=school" 'RSA.open "select * from student_content", "dsn=school" 'set rsa2 = server.createobject("adodb.recordset") 'rsa2.open "select student_name from student_info where student_id='"&session("loggedID")&"'", "dsn=school" Do while not RSA.EOF %> <html> <head> <title> none </title> </head> <body> <form method="post" action="doc1.asp" name="teacher"> <table border> <td>Student ID</td> <td>Student Name</td> <td>Story ID</td> <td>Story Name</td> <td>Student Story Status</td> <tr> <td><input type=radio name=RR value=<%=RSA.Fields ("story_id").Value%>;<%=RSA.Fields ("student_id").Value%>></input> <%= RSA.Fields ("student_id").Value %></td> <td> <%= RSA.Fields ("student_name").Value %></td> <td> <%= RSA.Fields ("story_id").Value %></td> <td> <%= RSA.Fields ("story_name").Value %></td> <td> <%= RSA.Fields ("status_student").Value%></td> </tr> </table> </body> </html> <% iCount = iCount + 1 rsa.movenext loop %> <p align="center"> <input type="submit" value="Submit" name="submit"></p> |
|
#2
|
|||
|
|||
|
wooooaaaaah, aspuser, take a step back and examine your program more closely before posting
if you're header is repeated as many times as records, your printing out the header inside the loop arn't ya? You need to pring out the heading information of the table, do the loop for the body, and then after the loop is over, then you close the table. You also never established < tr> and </ tr> for the table header. If you want your radio buttons outside the table why are you putting it in the cell? You can't start the table, close it, print the radio buttons, and then continue the table, that's just not possible. Take a step back, look at what you need to do, and then sit back down and continue coding, i think you've just confused yourself and it's pretty easy once you step back and look at it. |
|
#3
|
|||
|
|||
|
i tried what u said but that doesnt give me the desierd result. the first row i get as i want, but from 2nd i dont get under the headings..tehy are displayed one after the other. :-(
<% DIM SQL DIM RSA DIM RSA2 DIM BGC dim iCount iCount = 0 set RSA = Server.CreateObject("ADODB.Recordset") RSA.OPEN "SELECT sc.student_id,st.story_name,si.student_name,sc.story_id, sc.status_student FROM student_content sc, student_info si, story_table st where (sc.student_id = si.student_id and sc.story_id = st.story_id)", "DSN=school" 'RSA.open "select * from student_content", "dsn=school" 'set rsa2 = server.createobject("adodb.recordset") 'rsa2.open "select student_name from student_info where student_id='"&session("loggedID")&"'", "dsn=school" %> <html> <head> <title> none </title> </head> <body> <form method="post" action="doc1.asp" name="teacher"> <table border> <td>Student ID</td> <td>Student Name</td> <td>Story ID</td> <td>Story Name</td> <td>Student Story Status</td> <% Do while not RSA.EOF %> <tr> <td><input type=radio name=RR value=<%=RSA.Fields ("story_id").Value%>;<%=RSA.Fields ("student_id").Value%>></input> <%= RSA.Fields ("student_id").Value %></td> <td> <%= RSA.Fields ("student_name").Value %></td> <td> <%= RSA.Fields ("story_id").Value %></td> <td> <%= RSA.Fields ("story_name").Value %></td> <td> <%= RSA.Fields ("status_student").Value%></td> </tr> </table> </body> </html> <% iCount = iCount + 1 rsa.movenext loop %> <p align="center"> <input type="submit" value="Submit" name="submit"> </p> |
|
#4
|
|||
|
|||
|
A) you didn't step back and look =P
B) you didn't add the <tr> tags around the table header C) you are still closing the table in each loop, remember print table header loop print table contents end loop print table footer D) i don't know what you're errors are, that should work but if you're still getting undesired results can you give me a link to the page to view the error? |
|
#5
|
|||
|
|||
|
i dont know what exactly u r tryign to tell .. but i did try put the form tag away from loop no help...
here is my link ... if u can suggest http://218.186.133.61:8888/myweb2/loginDB.asp username = teacher password = teacher |
|
#6
|
|||
|
|||
|
i see no problem with the site....
|
|
#7
|
|||
|
|||
|
there is no error? probably i wasnt clear. but i am not getting hte desired results.
like hte headings are repeated for every row??? with as many radio buttons there are as many headings are there? i dont want this. also the radio button is coming under the 1st column? i hoep i am clear |
|
#8
|
|||
|
|||
|
try this
Code:
<%
DIM SQL
DIM RSA
DIM RSA2
DIM BGC
dim iCount
iCount = 0
set RSA = Server.CreateObject("ADODB.Recordset")
RSA.OPEN "SELECT sc.student_id,st.story_name,si.student_name,sc.story_id, sc.status_student FROM student_content sc, student_info si, story_table st where (sc.student_id = si.student_id and sc.story_id = st.story_id)", "DSN=school"
'RSA.open "select * from student_content", "dsn=school"
'set rsa2 = server.createobject("adodb.recordset")
'rsa2.open "select student_name from student_info where student_id='"&session("loggedID")&"'", "dsn=school"
%>
<html>
<head>
<title> none </title>
</head>
<body>
<form method="post" action="doc1.asp" name="teacher">
<table border>
<tr>
<td>Student ID</td>
<td>Student Name</td>
<td>Story ID</td>
<td>Story Name</td>
<td>Student Story Status</td>
</tr>
<%
Do while not RSA.EOF
%>
<tr>
<td><input type=radio name=RR value=<%=RSA.Fields ("story_id").Value%>;<%=RSA.Fields ("student_id").Value%>></input> <%= RSA.Fields ("student_id").Value %></td>
<td> <%= RSA.Fields ("student_name").Value %></td>
<td> <%= RSA.Fields ("story_id").Value %></td>
<td> <%= RSA.Fields ("story_name").Value %></td>
<td> <%= RSA.Fields ("status_student").Value%></td>
</tr>
<%
rsa.movenext
loop
%>
</table>
</body>
</html>
you cannot make the radio button appear outside of the table/ i don't understand why you would want to. It would require fancy formatting which i will not do for you. I don't understand why you have a problem with the radio buttons being in the table. you'll need some unique identifier per row.... |
|
#9
|
|||
|
|||
|
got it thanks!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > a very simple table problem! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|