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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the name of a script 1

Status
Not open for further replies.

CharlieMike73

Programmer
May 17, 2002
120
US
Hi,

I need to find the name of a script and place it in the <form action=&quot;&quot;> tag, so when a user submits the form it submits to itself.

<%
Dim Page_Name
Page_Name = Request.ServerVariables(&quot;SCRIPT_NAME&quot;)
%>

<form name=&quot;form1&quot; id=&quot;form1&quot; method=&quot;post&quot; action=&quot;<% response.write Page_Name %>&quot;>


When I run the above code I get this...
<form name=&quot;form1&quot; id=&quot;form1&quot; method=&quot;post&quot; action=&quot;/m_o/mats/reports/TMP2m2v94wvoj.asp&quot;>

I only want the 'TMP2m2v94wvoj.asp' part, how do I do this.

Is there a command I can use in place of SCRIPT_NAME that will give me just the name without the parent folder names?

And if NOT, then can someone post the code I will need to crop everything butthe file name off.

regards,
Charlie
 

How about...
DIM Page_Name, File_Name_Length

Page_Name = Request.ServerVariables(&quot;SCRIPT_NAME&quot;)
'Page_Name is: &quot;/m_o/mats/reports/TMP2m2v94wvoj.asp&quot;

File_Name_Length = Len(Page_Name) - InStrRev(Page_Name, &quot;/&quot;)
'File_Name_Length is: 35 - 18 = 17

Page_Name = Right(Page_Name, File_Name_Length)
'Page_Name is: &quot;TMP2m2v94wvoj.asp&quot;

Hope that works out for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top