|
 |
asptoday_discuss thread: Phone area code
Message #1 by "Michael Wang" <mtuppers@y...> on Mon, 25 Feb 2002 10:41:11
|
|
If Not Len(gPhone) = 10 Then
Response.Redirect "Error.asp?t=phone"
End If
If Left(gPhone, 3) = 604 Then
areaFound = 1
Else
areaFound = 3
End If
If Left(gPhone, 3) = 778 Then
areaFound = 2
Else
areaFound = 3
End If
If areaFound = 3 Then
Response.Redirect "Error.asp?t=areacode"
End If
my problem is if the areacode is not 604 it will redirect to error.asp?
t=areacode no matter what I try. Please help.
Message #2 by "Mark Phillips" <demontools@h...> on Mon, 25 Feb 2002 10:57:02 +0000
|
|
Dim AreaCode, IsValid, AreaFound
IsValid=True
If Len(gPhone) <> 10 Then
IsValid=False
Else
AreaCode = Left(gPhone,3)
If IsNumeric (AreaCode) Then
Select Case CInt(AreaCode)
Case 604
AreaFound=1
Case 778
AreaFound=2
Case Else
AreaFound=0
End Select
Else
IsValid=False
End If
If Not IsValid Then
Response.Redirect "Error.asp?t=phone"
Else
If CInt(AreaFound) =0 Then Response.Redirect "Error.asp?t=areacode"
End If
' rest of code follows here
' ..
' ..
>From: "Michael Wang" <mtuppers@y...>
>Reply-To: "ASPToday Discuss" <asptoday_discuss@p...>
>To: "ASPToday Discuss" <asptoday_discuss@p...>
>Subject: [asptoday_discuss] Phone area code
>Date: Mon, 25 Feb 2002 10:41:11
>
>If Not Len(gPhone) = 10 Then
> Response.Redirect "Error.asp?t=phone"
> End If
> If Left(gPhone, 3) = 604 Then
> areaFound = 1
> Else
> areaFound = 3
> End If
> If Left(gPhone, 3) = 778 Then
> areaFound = 2
> Else
> areaFound = 3
> End If
>
> If areaFound = 3 Then
> Response.Redirect "Error.asp?t=areacode"
> End If
>
>my problem is if the areacode is not 604 it will redirect to error.asp?
>t=areacode no matter what I try. Please help.
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
Message #3 by "Paul HUGUET" <paul@m...> on Mon, 25 Feb 2002 11:56:02 +0100
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0086_01C1BDF3.660523C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
Try this,
If Not Len(gPhone) =3D 10 Then
Response.Redirect "Error.asp?t=3Dphone"
End If
If Left(gPhone, 3) =3D "604" Then
areaFound =3D 1
Else
If Left(gPhone, 3) =3D "778" Then
areaFound =3D 2
Else
areaFound =3D 3
End If
End If
If areaFound =3D 3 Then
Response.Redirect "Error.asp?t=3Dareacode"
End If
hope it helps
Paul
----- Message d'origine -----
De : Michael Wang
=C0 : ASPToday Discuss
Envoy=E9 : lundi 25 f=E9vrier 2002 10:41
Objet : [asptoday_discuss] Phone area code
If Not Len(gPhone) =3D 10 Then
Response.Redirect "Error.asp?t=3Dphone"
End If
If Left(gPhone, 3) =3D 604 Then
areaFound =3D 1
Else
areaFound =3D 3
End If
If Left(gPhone, 3) =3D 778 Then
areaFound =3D 2
Else
areaFound =3D 3
End If
If areaFound =3D 3 Then
Response.Redirect "Error.asp?t=3Dareacode"
End If
my problem is if the areacode is not 604 it will redirect to
error.asp?
t=3Dareacode no matter what I try. Please help.
Message #4 by "Mark Phillips" <demontools@h...> on Mon, 25 Feb 2002 11:02:06 +0000
|
|
Oops, typing that into Hotmail I forgot one of the End Ifs :-) See below.
Dim AreaCode, IsValid, AreaFound
IsValid=True
If Len(gPhone) <> 10 Then
IsValid=False
Else
AreaCode = Left(gPhone,3)
If IsNumeric (AreaCode) Then
Select Case CInt(AreaCode)
Case 604
AreaFound=1
Case 778
AreaFound=2
Case Else
AreaFound=0
End Select
Else
IsValid=False
End If
End If
If Not IsValid Then
Response.Redirect "Error.asp?t=phone"
Else
If CInt(AreaFound) =0 Then Response.Redirect "Error.asp?t=areacode"
End If
' rest of code follows here
' ..
' ..
>
>>From: "Michael Wang" <mtuppers@y...>
>>Reply-To: "ASPToday Discuss" <asptoday_discuss@p...>
>>To: "ASPToday Discuss" <asptoday_discuss@p...>
>>Subject: [asptoday_discuss] Phone area code
>>Date: Mon, 25 Feb 2002 10:41:11
>>
>>If Not Len(gPhone) = 10 Then
>> Response.Redirect "Error.asp?t=phone"
>> End If
>> If Left(gPhone, 3) = 604 Then
>> areaFound = 1
>> Else
>> areaFound = 3
>> End If
>> If Left(gPhone, 3) = 778 Then
>> areaFound = 2
>> Else
>> areaFound = 3
>> End If
>>
>> If areaFound = 3 Then
>> Response.Redirect "Error.asp?t=areacode"
>> End If
>>
>>my problem is if the areacode is not 604 it will redirect to error.asp?
>>t=areacode no matter what I try. Please help.
>>
>
>
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
Message #5 by "=?iso-8859-1?q?Laeg=20Ent.?=" <laeg_enterprises@y...> on Mon, 25 Feb 2002 16:34:50 +0000 (GMT)
|
|
and it will continue to do so. Look at the logic in
your code. If its not 604 then areaFound=3, and what
happens when areaFound=3??? it goes to error.asp.
Rethink what you are trying to do and express it
better
--- Michael Wang <mtuppers@y...> wrote: > If Not
Len(gPhone) = 10 Then
> Response.Redirect "Error.asp?t=phone"
> End If
> If Left(gPhone, 3) = 604 Then
> areaFound = 1
> Else
> areaFound = 3
> End If
> If Left(gPhone, 3) = 778 Then
> areaFound = 2
> Else
> areaFound = 3
> End If
>
> If areaFound = 3 Then
> Response.Redirect "Error.asp?t=areacode"
> End If
>
> my problem is if the areacode is not 604 it will
> redirect to error.asp?
> t=areacode no matter what I try. Please help.
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
|
|
 |