|
|
 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

June 1st, 2006, 11:10 AM
|
|
Authorized User
|
|
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Requesting PAGE name
Hi,
Is it possible to request the name of a page?
So for eg: if it's page1 I execute code1 and if it's page2 I can execute code2 (using inc files).
Any help appreciated.:)
|

June 1st, 2006, 11:17 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How about this?
<%
myPage= Request.ServerVariables("PATH_INFO")
x=split(myPage,"/")
currPage=x(uBound(x))
response.write currPage
%>
Earl
www.jhdesigninc.com
|

June 2nd, 2006, 10:02 AM
|
|
Authorized User
|
|
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks,
How would I apply it to an IF statement? I've no idea as to where this code fits in with mine...(sorry).
Would it be
IF PAGE (your code) = page1
Then CODE1
ELSE
Code2
?
Hope to hear again.
|

June 3rd, 2006, 06:36 AM
|
|
Authorized User
|
|
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Tried the above code from erobb. This only displays the current page displayed.
I need help with the following scenario:
I have Form1.asp & Form2.asp and results.asp
So depending on which page/form is submitted the results page with execute a code.
How can I get results.asp to know which page/form has been submitted.
Thanks again.
|

June 3rd, 2006, 07:08 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
My bad, on your results.asp page put
<%
response.write request.ServerVariables("HTTP_REFERER")
%>
This will show you which page in your web site a user came from.
Earl
www.jhdesigninc.com
|

June 3rd, 2006, 07:56 AM
|
|
Authorized User
|
|
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks again: heres my final code that works now (finally):
<%
Dim wpage, mypage
wpage = request.ServerVariables("HTTP_REFERER")
mypage = Right(wpage, 8)
If mypage = "Managers" Then
Response.write "This is the Managers page"
Else
Response.write "This is the Workers page"
End If
%>
|

June 4th, 2006, 09:23 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Im glad it worked out for you. If you wanted to make it a little more dynamic. Say the manager page name changed to mypage.asp your call to Right(wpage, 8) would not work appropriately.
<%
Dim wpage, mypage
function whatPage(urlString)
x=split(myPage,"/")
currPage=x(uBound(x))
whatPage=currPage
end function
mypage = request.ServerVariables("HTTP_REFERER")
if mypage <>"" then
mypage= whatPage(request.ServerVariables("HTTP_REFERER"))
end if
If mypage = "Managers.asp" Then
Response.write "This is the Managers page"
Else
Response.write "This is the Workers page"
End If
%>
It may seem like a bit of over kill but from a scalabilty point of view this will work out better in the long run.
Earl
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |