Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi there,
I have an asp page that creates a record set from a database query. the problem i have is that no matter where i print the asp databse data from the recordset any html after it is always displayed to the screen first. So for example when I'm populating a form with data that a user will select and then "Submit" the submit/reset buttons are at the top of the page before all the data, regardless of the fact that i put the html for the buttons after the recordset data. Any ideas?
Thanks,
Mboto

Yeah sure, The printQuestions function is called in a standard dreamwearver prodcued html page. The databaseinclude just contains the functions for opening the database shown below
Databaseinclude.asp
<%
Dim strDB
Dim con ' Our Connection Object
Dim rs ' Our Recordset Object' Path to Database
strDB = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/dbasepath/yourdb.mdb")
Function OpenDatabase(intLockType) 'Open connection to the database and pass what type of locktype you requireSet con = CreateObject("ADODB.Connection")
con.Open strDB
Set rs = CreateObject("ADODB.Recordset")
rs.LockType = intLockTypeEnd Function
Sub CloseDatabase 'Close connection to the database
con.Close
Set con = Nothing
Set rs = NothingEnd Sub
%>-------------
showquestions.aspFunction PrintQuestions
Dim strSQL
Dim strTypeQuestion
Dim intCount
strTypeQuestion = ""
intCount = 0
Call Opendatabase(2)
strSQL = "select * from tblQuestions order by questiontype"
rs.Open strSQL, con
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="get" action="score.asp">
<%
Do While Not rs.EOF
intCount = intCount + 1
If Not rs("QuestionType") = strTypeQuestion Then
strTypeQuestion = rs("QuestionType")
%>
</tr>
<tr>
<td>
</tr>
<tr>
<td><div align="left"><%=rs("QuestionType")%> </div>
<td><div align="center">1 </div>
<td><div align="center">2 </div>
<td><div align="center">3 </div>
<td><div align="center">4 </div>
</tr>
<tr>
<td>
</tr>
<%
End if
%>
<tr>
<td><%=rs("Question")%> </td>
<td><div align="center"><input type="radio" name="question<%=rs("QuestionNo")%>" value="1"> </div></td>
<td><div align="center"><input type="radio" name="question<%=rs("QuestionNo")%>" value="2"> </div></td>
<td><div align="center"><input type="radio" name="question<%=rs("QuestionNo")%>" value="3"> </div></td>
<td><div align="center"><input type="radio" name="question<%=rs("QuestionNo")%>" value="4"> </div></td>
</tr>
<%
rs.MoveNext
Loop
%>
<input type="hidden" name="questionCount" value="<%=intCount%>">
<input type="submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form>
</table>
<%
End Function

Try putting the TR and TD tags around the buttons as well. Thats probably why they are floating at the top like that..

Hi Gpp,
Can't belive i posted a message with something that stupid. Doh! Classic error. Spent ages looking for that one too. Thanks for pointing out the obvious.
Cheers,
Mboto

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |