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

include file 1

Status
Not open for further replies.

HaveTrouble

Programmer
Jan 10, 2005
63
US
My website has 2 types of user setup - customer and seller. My server has 1 folder with all ASP available to customer and 1 folder for seller. There are some pages (view invoice) common to both users that I wish to put into a common folder so I only keep 1 source code. Customer and seller can search for customer # and pull up a list of invoices. Then click specific invoice # to view invoice.

So my common folder will include:
1. a search page that will post to itself to display a list of invoices matching the search criteria
2. view invoice page.

I put a invoice.asp to customer/vendor folder to include special formating for each user type:
<!-- include file="format.asp" -->
<!-- include virtual="\common\invoice.asp" -->


My \common\invoice.asp looks like:
<%
if request("custname") = "" then
%>
<form action=searchaccount.asp method=post>
<input type=text name=custname>
<input type=submit name=test value=test>
</form>
<%
else
.... SQL TO SEARCH INVOICES AND DISPLAY RECORDSET
end if
%>

However, when I click the button, it looks for the searchaccount.asp under customer or vendor account. How should I solve this problem ?

Thanks.

 
Hi,
Where should it be looking ( where is the asp page)?

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
\common\invoice.asp should post to itself. But instead of looking into \common\ folder, it's looking into customer\invoice.asp.
 
when I click the button, it looks for the searchaccount.asp under customer or vendor account.

The action tag has the value "searchaccount.asp" this is a relative url that the browser will append to the current location of the web page it is viewing. In this case your url is something like:


When the browser encounters a relative url it adds it to the current 'directory' e.g.:


If you want it to post to a specific page *not* relative to the current location, then use something like this in the action field:

action="/common/searchaccount.asp"

This will go to the root of the domain and add the action url e.g.:


you can also use ../../.. type directory traversals in the url if you want it to remain relative.

\common\invoice.asp should post to itself.

Then you should really have the action setting look something like this:

<form action="<%=request.servervariables("SCRIPT_NAME")%>" method="post">

or

<form action="/common/invoice.asp" method="post">

A smile is worth a thousand kind words. So smile, it's easy! :)
 
It works ! thanks !

One more question:
the page that call common\searchaccount.asp is in \customer\ and \vendor\ folder. It looks like:

<!-- include file="format.asp" -->
<!-- include virtual="\common\invoice.asp" -->
<!-- include file="addbottom.asp" -->

in \common\invoice.asp, if certain variable not set, then need to direct user to \common\accountSearch.asp. This is the code:

if acctNumber = "" then
server.execute "/common/invoice/accountSearch.asp"
else
..... NORMAL PROCESSING
end if

The execute function works but the addbottom.asp is not showing. Any advice ???
 
New question related to include files:

the page that call common\invoice.asp is in \customer\ and \vendor\ folder. It looks like:

<!-- include file="format.asp" -->
<!-- include virtual="\common\invoice.asp" -->
<!-- include file="addbottom.asp" -->

invoice.asp has a form that will send user to \common\invoice_save.asp once form is submitted. invoice_save.asp needs to run in the parent page so format.asp and addbottom.asp will be available. How can I achieve that ?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top