UGN Security
Posted By: Satori Basic ASP/ADO/HTML problem - 10/27/02 09:18 PM
Okay, so I'm having some trouble! I've never jacked with ADO before today, and so I started playing with it. No problem... created a very basic access database with a single table with some fields, and I can read from it and pipe the output to tables no problem. Yay!

Now, I'm trying to get the first field in each record that is displayed to have the data on a button, and where clicking the button will take you to a new page with a form that lets you edit the database. Now, the hard part ought to be the DB edit itself, but I've got that part working alright. I'm screwing up a really simple IF statement, and it's pissing me off. No matter what I do, the display isn't on a button, which means that I can't do action="edit.asp" and actually get to my edit script.... Here's the relevant lines:

Code
<tr>
<form method="post" action="edit.asp">
<%for each x in rs.Fields
      if x.name="no" then%>
           <td><input type="submit" name="no" value="<%=x.value%>"></td>
      <%else%>
           <td><%Response.Write(x.value)%></td>
      <%end if
next
%>
</form>
<%rs.MoveNext%>
</tr>
What am I not doing correctly here? The display is just the value of the "no" field in the table, never the button with the value on it as text linking me to my other script.

Help?
Posted By: SilentRage Re: Basic ASP/ADO/HTML problem - 10/27/02 10:11 PM
Code
<tr>
<form method="post" action="edit.asp">
<%
for each x in rs.Fields
    if x.name="no" then
        Response.Write "<td><input type=""submit"" name=""no"" value=""" & x.value & """></td>"
    else
        Response.Write "<td>" & x.value & "</td>"
    end if
    rs.MoveNext
next
%>
</form>
</tr>
Give that a shot.
© UGN Security Forum