Forum Moderators: open

Message Too Old, No Replies

"get" or/and "post"

passing data in asp forms

         

mossimo

8:45 pm on Apr 20, 2003 (gmt 0)

10+ Year Member



Hello People

I have built a sing up form in asp that on submit calls an additional asp script witch contains code to call the mail server and send the form contents to my inbox "works great". Here's the catch, using hidden fields the form will pass the users input on to Papal to pre-populate the form fields at Papal.

My form uses "method=get" and Papal uses "method=post"
Witch ever appears first in the script is the only one that works. It seems i ether need to combine them or re write the end of of the mailsend script to pass on the data to Papal. As you can see bellow the end of the mailsent script currently only returns a success message.

if not Mailer.SendMail then
Response.Write " Mailing Failed... Error is: <br>"
Response.Write Mailer.Response
else
Response.Write "sent successfully Thank You.<p>"
end if
%>

Can you tell I don’t know jack about asp.

Thanks
mossimo

takagi

10:53 am on Apr 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi mossimo. It is possible to have a query string while the method is still POST. Here is the trick:


<FORM NAME="Form1" METHOD="POST" ACTION="somefile.asp?Err=OK">

In the somefile.asp you can get the value for Err with

strErr = Cstr(Request.QueryString("Err"))

like you're used to for a GET method. And the fields from the form with 'Request.Form'.

But be careful! You better not use the same variable name for both POST and the query string because it gets very confusing. Especially if you (or somebody else) have to change that file in the future. So you better explain this very good in the comment.

In Javascript it is possible to update the action of a form with some code like this:

Form1.action = "somefile.asp?Err=Fail123";