submit buttons in loop

Results 1 to 2 of 2

Thread: submit buttons in loop

  1. #1
    Join Date
    Dec 1969

    Default submit buttons in loop

    Hi all!<BR><BR>I have a recordset and I am generating one edit(submit button) for each record.when a user clicks on that submit button...he should be able to edit that particular record...<BR><BR>How to do this??

  2. #2
    Join Date
    Dec 1969

    Default I like this...

    It takes a tiny bit of cleverness, but I like it!<BR><BR>&#060;INPUT Type=Submit Name="EDIT_&#060;%=RS("recordID")%&#062;" Value="Edit this"&#062;<BR><BR>See that? Each submit button gets a *different name*. And the name uses the primary key of the record (I called it "recordID" here...adjust to match your table) as part of the name.<BR><BR>Now, on the ASP page where you process these:<BR><BR>&#060;%<BR>recid = ""<BR>For Each fld In Request.Form<BR> If Left(fld, 5) = "EDIT_" Then &#039; found the SUBMIT field...<BR> recid = Mid( fld, 6 ) &#039; everthing after the EDIT_<BR> Exit For<BR> End If<BR>Next<BR><BR>If recid = "" Then<BR> Response.Write "Something is did we get here without record?"<BR> Response.End<BR>End If<BR><BR>&#039; get and display the record<BR>SQL = "SELECT * FROM table WHERE recordID = " & recid<BR>...<BR><BR>%&#062;<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts