Forum Moderators: open

Message Too Old, No Replies

Submit return blank

.....

         

vanjamier

2:29 am on Dec 27, 2004 (gmt 0)

10+ Year Member



Hi al...

I cant seem to figure out why i get blank...

This is my 1st form


<form id=form1 name=form1 method="post" action="license_delete.asp">
<center><INPUT id=button1 type=submit value=Delete name=btnDel></center>
</form>

This is my 2nd form


<%
on error goto 0

Set rs = Server.CreateObject("ADODB.RecordSet")

'QueryStrings
strId = Request.QueryString("ID")

'get the selected software info
sqlstr = "SELECT " & _
" Filename,Filesize,FileType,SwName,SwVersion,SwCompany,LicenseNumber" & _
" ,LicenseDate,LicenseEndDate,LicenseAmount,siasid,Ownername,Owneremail" & _
" from LicenseTab where id = '" & strID & "' "

rs.Open sqlstr, connStr
If Request.QueryString("btnDel") = "Delete" Then

Set rs2 = Server.CreateObject("ADODB.RecordSet")

sqlstr ="DELETE FROM LicenseTab Where id = '" & strID & "' "

rs2.Open sqlstr2, connStr

Response.Write "<font color=""green"">Data was successfully deleted..."
Response.Write "</font>"
Response.Write "<br>"
Response.Write "<A href=""license_list.asp"">Click here to continue.."

End if

%>

I get link to my 2nd page when i click on delete on the 1st page..
but..it displays a blank page...?

Zaphod Beeblebrox

12:55 pm on Dec 27, 2004 (gmt 0)

10+ Year Member



Try changing this:
If Request.QueryString("btnDel") = "Delete" Then

to this:
If Request.Form("btnDel") = "Delete" Then

vanjamier

2:17 am on Dec 28, 2004 (gmt 0)

10+ Year Member



hey thanks..
i did some other adjustments including wht u just said..and it works..
What i dun understand is when to use querystring and form...

syber

2:30 am on Dec 28, 2004 (gmt 0)

10+ Year Member



If the form's method="post", you use Request.Form - otherwise use Request.QueryString.

You can avoid the problem entirely by leaving off the collection name. Request("ID") will work in either case.

Art

Zaphod Beeblebrox

11:31 am on Dec 30, 2004 (gmt 0)

10+ Year Member



The QueryString is everything after the? in a url. When using the default method "get" instead of "post" the values are passed in the url.

I'd personally not advise using simply Request("Field"), because it not only suggests you're using a default because you're not sure what you're doing, but also complicates the possibility to post to url that allready has a querystring:

<form method='post' action='savedata.asp?mode=customer'>

This could of course be solved with hidden input fields, but still...if you know what you're doing, you don't need it.