Page 1 of 1
probably simple solution to parse error
Posted: Thu Nov 11, 2004 4:17 am
by pEtErB
Forgive this simple question from a newbie. It is probably so simple that the answer isn't in any of the existing forums. (I did check.) I inserted a piece of javascript into a php file, and when I call the script in the usual manner :
<script language="JavaScript" type="text/JavaScript">
my browser returns the following error:
Parse error: parse error, expecting `','' or `';'' in [FILENAME] on line [THISLINE}
Would someone please tell me how to invoke this script without getting this error? Thanks.
Posted: Thu Nov 11, 2004 4:20 am
by Wayne
can you give us the code?
Posted: Thu Nov 11, 2004 6:22 am
by pEtErB
The whole thing? It's fairly big... basically, it's a php-based guestbook, and there is all kinds of authentication stuff. I am trying to use javascript to block certain email addresses from spamming my guestbook (promoting online gambling in Russia, etc.), so I put the javascript in the 'header' part of the guestbook (where I have already successfully put CSS, etc.). The js creates an array of blocked email addresses, and the js is then called by an onBlur event in the form the visitor fills out. Is this enough info, or should I include more code? Basically, I don't know the proper syntax.
Posted: Thu Nov 11, 2004 6:27 am
by kettle_drum
Well the error is telling you what is wrong. Its a parse error with php on the line it mentions in the file it says. Open up that file and have a look at the line it says. You may see the error straight away - probably missing a closing quote on something. Also check the line above as it maybe an error carried on from that line.
If your still stuck then post use the few lines of code on and around where it says the error is.
Posted: Thu Nov 11, 2004 12:53 pm
by pEtErB
I solved the problem. As I suspected, it was a syntax problem. As we all know, php uses quotes, so if you want to ignore quotes and treat them like a string, you have to precede them with a backslash. I had copy-n-pasted my js code, and neglected to think of this issue. Thanks for your replies. I would move this topic to the 'solved' pile if I knew how.