Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing variable to inline frame

Status
Not open for further replies.

sweetleaf

Programmer
Jan 16, 2001
439
CA
Hi,

Can anyone tell me how i can pass the value of a page element from an asp to an inline frame?

say i have this on Page1.asp
<input type=text id=text1 name=text1 value=&quot;Hi&quot;>

..can i simply do something like th following on Page2.asp?

x = request.Form(&quot;text1&quot;)
strSQL = select * from tbl1 where id = x

any help is much appreciated thanks!
 
More specifically, this should work fine.

page1.asp
<form method=&quot;post&quot; action=&quot;page2.asp&quot;>
<input type=&quot;text&quot; id=&quot;text1&quot; name=&quot;text1&quot; value=&quot;Hi&quot;><br>
</form>


page2.asp
dim x
x = Request.Form(&quot;text1&quot;)
strSQL = &quot;select * from tbl1 where id = '&quot; & x & &quot;'&quot;


Notes:

#1: The method of the form needs to be set to post to access that element using Request.Form.

#2: Request.Form is looking at the element name. I noticed that you have an id in your element tag. That's fine if you need it for something else, just be aware that Request.Form is looking at the name key.

#3: Please note the single quotes next to the double quotes in the SQL statement. I made them RED so they're easier to notice. You need to do that for string comparisons, inserts, updates, etc.. in SQL. That way, if you were to issue a Resonse.Write strSQL right after that line, it would look like this.


select * from tbl1 where id = '
somestring'


Hope this helps.. :)

ToddWW

Hope this help
 
Hi Todd,

Thanks for your feedback. only thing is, i need to submit page1 to itself for processing - and page2 is an inline frame thats already &quot;nested&quot; in page1, so i don't want to navigate to it.

Thanks though!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top