 |
| 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
|
|
|
|

June 16th, 2004, 10:37 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
why am I getting a syntax error?
Hi all
Just wondering why I get a syntax error with this code:
if
request.Form("main_section.asp?id=5") then response.Redirect("articles.asp")
end if
else
.....rest of code.
Am I doing this correctly?
I'm getting a syntax error:
Microsoft VBScript compilation error '800a03ea'
Syntax error
/st-pre/main_section.asp, line 7
if
--^
where if is the if you see above in the code.
thanks
Adam
|
|

June 16th, 2004, 10:40 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
I see an if right below where you wrote, "Just wondering why I get a syntax error with this code:".
I think you need to have the if and the request.form(...) line on the same line.
HTH,
Snib
<><
|
|

June 16th, 2004, 11:32 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
And the response.Redirect("articles.asp") on the next line. You may be able to do an inline statement, but you wouldn't use the "end if".
Brian
|
|

June 16th, 2004, 12:23 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks guys
I've done what you said and no syntax error, but it just ignores the if statement now?
any ideas?
cheers
Adam
|
|

June 16th, 2004, 12:40 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
And what does this do:
If Request.Form("main_section.asp?id=5") Then
Request.Form will look at a HTML form control submitted to the server. I don't think you have a control with an HTML name attribute with a value of main_section.asp?id=5, do you? e.g.
<input type="text" name="main_section.asp?id=5" />
So, I think you're after something else. What are you trying to accomplish?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Master Techno - Deep Star Trax by Various Artists (Track 14 from the album: Techno Beat I) What's This?
|
|

June 16th, 2004, 04:19 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar
sorry, this is what I was supposed to be saying:
if request.querystring("main_section.asp?id=5") then
response.Redirect("articles.asp")
else
basically what I've got is a menu that calls data on a dynamic page depending on the id of the data. However, one of the pages I'm trying to accomplish need a different approach; this page is called articles.asp and has the id of 5; hence, if the querystring id=5 I want it to jump to articles.asp and not the normal dynamic page.
does this help?
thanks
Adam
|
|

June 16th, 2004, 04:25 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Change the querystring line like this:
if request.querystring("id") == 5 then response.Redirect("articles.asp")
HTH,
Snib
<><
|
|

June 16th, 2004, 05:22 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
You are right Snib. But just a small change in that.
Got to remove one of those "=" symbols. It should look like,
Code:
if request.querystring("id") = 5 then response.Redirect("articles.asp")
Cheers!
_________________________
-Vijay G
 Strive for Perfection 
|
|

June 16th, 2004, 05:27 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Oops, I am still not used to ASP! '==' is the syntax JavaScript and PHP use in this situation (both areas I specialize in).
Sorry :-)
Snib
<><
|
|

June 17th, 2004, 02:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
great, thanks for the input guys.
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Parse error: syntax error, unexpected T_ELSE in /h |
vipin k varghese |
BOOK: XSLT Programmer's Reference, 2nd Edition |
4 |
September 29th, 2011 01:19 AM |
| Ch 4: Parse error: syntax error, unexpected T_SL |
hanizar77 |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
0 |
June 23rd, 2008 09:17 PM |
| Parse error: syntax error, unexpected T_STRING |
ginost7 |
Beginning PHP |
1 |
November 9th, 2007 02:51 AM |
| VB Error: Syntax Error or Access Violation |
codehappy |
VB How-To |
7 |
October 3rd, 2007 05:41 PM |
| Compile error: Syntax error: & Else without HELP |
Corey |
VB How-To |
2 |
April 21st, 2006 03:25 PM |
|
 |