POST

P

paulmitchell507

I have a simple SQL query that is run inside a asp page. I would
normally display the results using the response.write("my name is: " &
name) if I wanted the output displayed. On this occasion I want to
post the results to another .asp page. How do I get the "name" field
into Request.Form("name") that I need to pass to the next .asp page?
 
B

Bob Barrows [MVP]

paulmitchell507 said:
I have a simple SQL query that is run inside a asp page. I would
normally display the results using the response.write("my name is: " &
name)
Err ... the parentheses are not needed unless you are using javascript
if I wanted the output displayed. On this occasion I want to
post the results to another .asp page. How do I get the "name" field
into Request.Form("name") that I need to pass to the next .asp page?

Use a hidden field:
<form>
....
<input type="hidden" name="name" value="<%=Request.Form("name")%">
....
</form>

Note: <%= is shorthand for <%Response.Write
 
P

paulmitchell507

Err ... the parentheses are not needed unless you are using javascript


Use a hidden field:
<form>
...
<input type="hidden" name="name" value="<%=Request.Form("name")%">
...
</form>

Note: <%= is shorthand for <%Response.Write

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Thank you taking the time to reply to my basic question!
To explain a little further, after I run the SQL, I am left with a
single value for holiday_ID. I then call the following to pass the
holiday_ID to another asp file with our any user input
<form
method=post
action='email2.asp'
name='myform'>

<input
type=hidden
name='myname'
value="<%=Request.Form("holiday_id")%>">

</form>

<script>
window.onLoad = document.myform.submit();
</script>

I am trying to display the holiday_ID in the email2.asp page as I am
not sure that the holiday_ID is sent. I have put the following on the
email2.asp page,

<%
'declare your variables
Dim holiday_ID

'Receiving values from Form, assign the values entered to variables
holiday_ID = Request.Form("holiday_ID")

If holiday_ID <>"" Then
Response.write("No records returned.")
Else
Response.Write("my id is:" & holiday_ID)
End If
%>

If I run the app, "my id is" gets displayed but no holiday_ID. It
would appear that somthing is passed to the email2something.asp page,
but what?
I am sure it's obvious, I am not familiar with asp!
 
B

Bob Barrows [MVP]

Thank you taking the time to reply to my basic question!
To explain a little further, after I run the SQL, I am left with a
single value for holiday_ID. I then call the following to pass the
holiday_ID to another asp file with our any user input
<input
type=hidden
name='myname' <====
value="<%=Request.Form("holiday_id")%>">
'Receiving values from Form, assign the values entered to variables
holiday_ID = Request.Form("holiday_ID")

You called the hidden element "myName", not "holiday_ID"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top