Results 1 to 14 of 14
-
05-12-2003, 11:28 PM #1Aspiring Evangelist
- Join Date
- Dec 2002
- Location
- Australia
- Posts
- 389
Help please with php close window problem
Hello
I'm wondering if anyone can help me with a php/javascript problem I'm having?
I've searched here and on google, but haven't been able to find what I'm looking for.
Problem:
I have a pop up window that runs a form and then when completed goes to a confirm page.
On this confirm page, I want to add a close window link at the bottom, such as :
PHP Code:<a href="javascript:window.close();"><small>Close This Window</small></a>
Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
How can I best add this to my code: (for example - which does not work!)
PHP Code:echo "Click < a href="javascript:window.close();">here</a> to close this window.";
Thanx!!
-
05-12-2003, 11:32 PM #2Evenly Divided
- Join Date
- Aug 2001
- Posts
- 4,028
I am no guru, but I think it's because of the middle quote:
Do this:
echo "Click < a href="javascript:window.close();\">here</a> to close this window.";
-
05-12-2003, 11:39 PM #3Web Hosting Master
- Join Date
- May 2001
- Location
- Prince Edward Island
- Posts
- 965
Not sure if this will help or not.
http://forums.devshed.com/archive/16/2002/10/1/44626[url]I got nothing/url]
For clarity's sake, don't use "<ip address of hostname>" use the ACTUAL 32-bit numeric IP address of the machine.
-
05-12-2003, 11:42 PM #4Aspiring Evangelist
- Join Date
- Dec 2002
- Location
- Australia
- Posts
- 389
Thanx Mekhu for the reply
Nope... that returns the same error
Any other ideas???
-
05-12-2003, 11:48 PM #5Aspiring Evangelist
- Join Date
- Dec 2002
- Location
- Australia
- Posts
- 389
Hi MikeM
I'd already found that page and tried it, but either I didn't enter the info correctly into the php page or it didn't work.... but it still turns up the same error.
Thanx for the reply though! Much appreciated
-
05-12-2003, 11:49 PM #6Web Hosting Master
- Join Date
- May 2001
- Location
- Prince Edward Island
- Posts
- 965
Maybe try calling a .js file instead??
[url]I got nothing/url]
For clarity's sake, don't use "<ip address of hostname>" use the ACTUAL 32-bit numeric IP address of the machine.
-
05-12-2003, 11:53 PM #7Aspiring Evangelist
- Join Date
- Dec 2002
- Location
- Australia
- Posts
- 389
Hi
?? I don't think I understand?
Call a js file from inside the .php file? or ....
(apologies if I'm being a little thick here )
-
05-13-2003, 12:05 AM #8WHT Addict
- Join Date
- Jan 2003
- Location
- Glendale, Arizona, USA
- Posts
- 165
You have your code like:
PHP Code:echo "Click <a href="javascript:window.close();">here</a> to close this window.";
PHP Code:echo "Click <a href=\"javascript:window.close();\">here</a> to close this window.";
PHP Code:echo <<<END
Click <a href="javascript:window.close();">here</a> to close this window.
END;
Let me know if that fixes it.
-
05-13-2003, 12:19 AM #9Aspiring Evangelist
- Join Date
- Dec 2002
- Location
- Australia
- Posts
- 389
Hi PUBH
Thanx for the reply!
That kind of worked It doesn't give me the parse error anymore... however, instead of closing the window it takes me to my error404 page.
Feeling very blonde right now
-
05-13-2003, 12:27 AM #10WHT Addict
- Join Date
- Jan 2003
- Location
- Glendale, Arizona, USA
- Posts
- 165
Well it appears the errors from the PHP side are gone.
I would assume your errors are resulting in your JavaScript, but unfortunately I am not very experienced with it. I will look it up real quick and see if I can figure it out for you...
-
05-13-2003, 12:29 AM #11WHT Addict
- Join Date
- Jan 2003
- Location
- Glendale, Arizona, USA
- Posts
- 165
Your URL should look something like:
Code:Click <a href="javascript:window.close();">here</a> to close this window.
Try it out.
EDIT: In the above example there SHOULD NOT be a space between JAVA and SCRIPT, but for some reason when I post, or edit, it appears with no space in here, but when viewing, it adds a space. The below site shows how it should look (JavaScript-wise):
http://www.codeave.com/javascript/code.asp?u_log=7014Last edited by PUBH; 05-13-2003 at 12:40 AM.
-
05-13-2003, 12:44 AM #12Aspiring Evangelist
- Join Date
- Dec 2002
- Location
- Australia
- Posts
- 389
Hi PUBH!
You're a star! That did it
The same thing obviously happened in my javascript quote added in my first post, only I didn't pick it up (d'oh).
My close window javascript snippet of course has the two as one word.... as it works... but when I have copied and pasted from here I've added the space and not noticed. (told you I was feeling very blonde today!)
Thanx again
-
05-13-2003, 12:52 AM #13WHT Addict
- Join Date
- Jan 2003
- Location
- Glendale, Arizona, USA
- Posts
- 165
No problem!
Glad I could pass along some of my knowledge. I've been so bored recently that I've been doing all sorts of weird things with my time like http://www.planetubh.com/links/ where I plan on adding all my commonly visited websites (gets extremely old having to type it again because it gets shoved off your history or whatever it is called... I'm still surprised I was able to get the counting thing to work, lol).
Just remember that most errors that completely stump you usually involve something extremely simple (such as forgetting to add a quote, backslash, semi-colon, space, etc).
-
05-13-2003, 06:18 AM #14Web Hosting Master
- Join Date
- May 2002
- Location
- UK
- Posts
- 2,997
you have a space in the word javascript.