Wrox Programmer Forums
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 10th, 2003, 01:09 PM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Little Problem...

Can anyone tell me what I'm doing wrong?

Here is my code:

<code>
&lt;%
    Function CityCost(NumberDays)
        varHotelTotal = NumberDays*175
        varMealsTotal = NumberDays*75
        varAirportTransport = 85
        CityCost = varHotelTotal+varMealsTotal+varAirportTransport
    End Function

    Funtion SuburbCost(NumberDays)
        varHotelTotal = NumberDays*85
        varCarTotal = NumberDays*45
        varMealsTotal = NumberDays*75
        SuburbCost = varHotelTotal+varCarTotal+varMealsTotal
    End Function

    varLocation = Request.Form("location")
%&gt;

&lt;h2>You have chosen the hotel in the &lt;%=varlocation%>.&lt;br>
Your estimated costs for this seminar will be:&lt;/h2>

&lt;p>&lt;%
    Select Case varLocation
        Case "city"
            varCost = CityCost(2)
            Response.Write "The two day course will cost $" &amp; varCost &amp; "&lt;br>"
            varCost = CityCost(4)
            Response.Write "The four day course will cost $" &amp; varCost &amp; "<br>"
            varCost = CityCost(6)
            Response.WRite "The six day course will cost $" &amp; varCost &amp; "&lt;br>"
        Case "suburb"
            varCost = SuburbCost(2)
            Response.Write "The two day course will cost $" &amp; varCost &amp; "&lt;br>"
            varCost = SuburbCost(4)
            Response.Write "The four day course will cost $" &amp; varCost &amp; "&lt;br>"
            varCost = SuburbCost(6)
            Response.Write "The six day course will cost $" &amp; varCost &amp; "&lt;br>"
    End Select
%>&lt;/p>
</code>

And when I pull up this document from my form, it doesn't work. I get an error message saying "error on line 24" expected statement "End Function", but I do have that statement ending all of my function areas. Can someone take a look at my code and tell me what's wrong?<p>

I am using the book "Active Server Pages 3.0 2001 edition" and I am doing the sample project on page 209. My code matches exactly, and I get that error.

 
Old September 10th, 2003, 01:18 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Look at this code. It says Funtion instead of Function.....

HtH,

Imar

Quote:
quote: Funtion SuburbCost(NumberDays)
        varHotelTotal = NumberDays*85
        varCarTotal = NumberDays*45
        varMealsTotal = NumberDays*75
        SuburbCost = varHotelTotal+varCarTotal+varMealsTotal
    End Function
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.