[SOLVED] close current window in php script

This is a discussion on "[SOLVED] close current window in php script" within the PHP Forum section. This forum, and the thread "[SOLVED] close current window in php script are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 13th, 2007, 05:27
Junior Member
Join Date: Nov 2007
Location: Oregon
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] close current window in php script

I have a form to email script. At the end of the script, after the email has been submitted, the script echos "The consultation form has been submitted...Thank you"

This echo is now alone on the window. Is it possible to add on a function to close this window? Could this be done within the php script, after the "thank you" echo?

Or does this need to be placed within an html page including the php script, in javascript? (creating a button to click to close the window)

Thanks for all the great advice!
Reply With Quote

  #2 (permalink)  
Old Dec 13th, 2007, 05:30
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: close current window in php script

You simply need to write out some javascript with php

PHP: Select all

echo 'The consultation form has been submitted... Thank You!<br /><br /><button onclick="window.close()">Close Window</button>'
Cheers
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #3 (permalink)  
Old Dec 13th, 2007, 05:33
Junior Member
Join Date: Nov 2007
Location: Oregon
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Re: close current window in php script

Wow, man! You are fast!

Thanks a bunch!
Reply With Quote
  #4 (permalink)  
Old Dec 13th, 2007, 05:42
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: close current window in php script

LOL right place at the right time.. Glad it works
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #5 (permalink)  
Old Dec 13th, 2007, 10:00
Junior Member
Join Date: Dec 2007
Location: UK
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] close current window in php script

That was javascript... you printed the js in php but still not php... I wonder is there a php function that does this as well. Anyone know?
Reply With Quote
  #6 (permalink)  
Old Dec 13th, 2007, 10:04
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] close current window in php script

No. LOL simple as that.... PHP is server side, it does not affect the client computer in any way. It serves the text/data to be loaded and this is all, it writes the javascript but cannot interact with the client at all
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #7 (permalink)  
Old Dec 13th, 2007, 21:29
Junior Member
Join Date: Dec 2007
Location: UK
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] close current window in php script

What a stupid question to have put to you guys and having coded php for as long as i have you would have thought I'd put two and two together. I am always trying to explain to people server side and client side scripting and yet I get it wrong myself... man im embarrassed!
Reply With Quote
  #8 (permalink)  
Old Dec 14th, 2007, 05:38
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: [SOLVED] close current window in php script

hehe. Don't worry... It also took me ages to understand that concept - PHP is server-side and generates HTML.....
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
link to close window in html page cgst81 Web Page Design 1 Jun 1st, 2008 11:34
[SOLVED] press button to close window R8515198 Web Page Design 2 Jan 27th, 2008 16:39
[SOLVED] Getting the current domain MikeHopley PHP Forum 4 Nov 22nd, 2007 17:40
[SOLVED] open new window from main window AdRock Other Programming Languages 1 Nov 1st, 2007 02:45
resizing current window with java danydrunk Other Programming Languages 2 Jul 12th, 2006 21:27


All times are GMT. The time now is 02:02.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43