Re: A couple of questions - 1 asp, 1 forms

by =?iso-8859-1?Q?St=E9phane?= Bergeron <stephberg(at)videotron.ca>

 Date:  Fri, 10 Mar 2000 18:43:11 -0500
 To:  Wieland <nwieland(at)tampabay.rr.com>,
hwg-techniques(at)hwg.org
 References:  pobox
  todo: View Thread, Original
At 06:59 AM 10/03/00 -0500, Wieland wrote:
>I have two questions:
>
>1.  Does anyone know why this code will not work?
>
><%
>If straffiliate2 <> "" then
>response.write "<!--#include virtual=3D'/inc/LP.inc' -->"
>else
>response.write (" ")
>end if
>%>
>
>I don't get an error - I just don't get the result

This will never work for the simple reason that the server parses and=20
"includes" any code in Server Side Includes _before_ it interprets ASP=20
code.  That's why many developers use SSI to include reusable ASP=20
subroutines, functions or constants declarations while keeping the code=20
readable and clean.  For the above to work , you'll need to add the=20
complete code in your LP.inc file inside your If-Else construct.


>2.  How do you include two actions in a form action - i.e.  a confirmation
>page and a cgi to write to a text file. Is it as simple as:
>
><form method=3D"post" action=3D"write.cgi;confirmation.asp">

Short answer is... you can't... at least not to my knowledge.  There's no=20
reason why you couldn't do everything in one page though.  Just include the=
=20
code that writes the info to a text file before any HTML is sent to the=20
server.  In ASP you do that with the FileSystemObject and its various=20
methods.  Then you either send the rest of the confirmation page with the=20
appropriate message depending on the validation of the form fields you=20
perform.  You could redirect the user back to the form even before the=20
server starts sending the confirmation page to the browser if they supplied=
=20
incorrect or incomplete info.

HTH!

St=E9phane Bergeron

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA