| | |
Killing / Releasing IFrame
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 3
Reputation:
Solved Threads: 0
Hi there,
I have a problem that I have called a PHP script in IFRAME and I want to release that IFRAME once the tasks are completed.
Parts of the scripts are as follows:
Process_form.php:
===> I need $success_page to load without any frames <====
Config.php:
Thanks.php:
Any help will be appreciated to sort the problem out please.
===> I need $success_page to load in the same browser releasing the previous IFRAME <====
Cheers!!
I have a problem that I have called a PHP script in IFRAME and I want to release that IFRAME once the tasks are completed.
Parts of the scripts are as follows:
Process_form.php:
php Syntax (Toggle Plain Text)
if($send_back_to_form == "yes") { $redirect_to = $form_page_name."?done=1"; } else { $redirect_to = $success_page; }
===> I need $success_page to load without any frames <====
Config.php:
$success_page = "thanks.php"; Thanks.php:
echo '<meta http-equiv="refresh" content="5;url=http://www.mysite.com/index.php" />' Any help will be appreciated to sort the problem out please.
===> I need $success_page to load in the same browser releasing the previous IFRAME <====
Cheers!!
Last edited by peter_budo; Jan 11th, 2009 at 2:30 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: May 2008
Posts: 257
Reputation:
Solved Threads: 20
you should be able to do it with a bit of javascript
that should work or you could send a link that the user would have to click on with a target of _top
Hope that works
Rgds,
Sam Rudge
php Syntax (Toggle Plain Text)
<?php echo '<script type="text/javascript">'; echo"parent.window.location = $success_page"; echo'</script>'; ?>
php Syntax (Toggle Plain Text)
<?php echo"<a href=\"$success_page\" target=\"_top\">Click Here</a>"; ?>
Rgds,
Sam Rudge
Last edited by peter_budo; Jan 11th, 2009 at 2:31 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
•
•
Join Date: May 2008
Posts: 257
Reputation:
Solved Threads: 20
•
•
•
•
you should be able to do it with a bit of javascript
<?php
echo '<script type="text/javascript">';
echo"parent.window.location = $success_page";
echo'</script>';
?>
that should work or you could send a link that the user would have to click on with a target of _top
<?php
echo"<a href=\"$success_page\" target=\"_top\">Click Here</a>";
?>
Hope that works
Rgds,
Sam Rudge
Rgds (Again
),Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
•
•
Join Date: May 2008
Posts: 257
Reputation:
Solved Threads: 20
•
•
•
•
I think you could also use opener.location instead of parent.window.location, that might work better.
Rgds (Again),
Sam Rudge
self.parent.location=
in the javascript not parent.window.location or opener.location
Rgds (Yes again
Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
•
•
Join Date: Jan 2009
Posts: 3
Reputation:
Solved Threads: 0
Dear Sam,
Really appreciated!!
But none of these worked!! I don't know why, may be the placement of the script was not appropriate. Actually three different files are working alongside, can you please be more specific where I should place this script please?
File no. 1 is: Process_form.php:
===> I need $success_page to load without any frames <====
File no. 2 is: Config.php:
File no.3 is: Thanks.php:
Kindest Regards,
Really appreciated!!
But none of these worked!! I don't know why, may be the placement of the script was not appropriate. Actually three different files are working alongside, can you please be more specific where I should place this script please?
File no. 1 is: Process_form.php:
php Syntax (Toggle Plain Text)
if($send_back_to_form == "yes") { $redirect_to = $form_page_name."?done=1"; } else { $redirect_to = $success_page; }
===> I need $success_page to load without any frames <====
File no. 2 is: Config.php:
$success_page = "thanks.php"; File no.3 is: Thanks.php:
echo '<meta http-equiv="refresh" content="5;url=http://www.mysite.com/index.php" />' Kindest Regards,
Last edited by peter_budo; Jan 11th, 2009 at 2:31 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: May 2008
Posts: 257
Reputation:
Solved Threads: 20
Right then,
this should work (If it doesn't then i'm out of ideas)
Copy that code onto Process_form.php (Backup the original though) and see how that works. I wonder if this would count towards my IT GCSE
Hope that works for you,
Regards,
Sam Rudge
this should work (If it doesn't then i'm out of ideas)
PHP Syntax (Toggle Plain Text)
<?php include('config.php'); //Include the config file if($send_back_to_form == "yes") { $redirect_to = $form_page_name."?done=1"; } else { $redirect_to = $success_page; } //Output a page that sends the parent page to somewhere (Not the IFrame) //This page has no content other than standard HTML and JS ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript"> <!-- function outsideframe() { opener.location = '<?php echo $redirect_to; ?>'; } //--> </script> </head> <body onload="javascript:outsideframe()"> <!-- In the rare case a user don't have javascript --> <a href="<?php echo $redirect_to; ?>" target="_parent">Click To Continue</a> </body> </html>
Hope that works for you,
Regards,
Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
I have a frame breakout in succcess.page.php
or
degrades badly if javascript disabled
javascript Syntax (Toggle Plain Text)
<script type='text/javascript' language='javascript'> if (top.location != location) { top.location.href = document.location.href ; } </script>
javascript Syntax (Toggle Plain Text)
<script type='text/javascript' language='javascript'> if (parent.frames.length > 0) { parent.location.href = self.document.location } </script>
Last edited by almostbob; Jan 11th, 2009 at 11:40 am.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Other Threads in the PHP Forum
- Previous Thread: Calling all Web Design and Programer instructors and tutors.
- Next Thread: how to install and test zend framework 1.7.2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code codingproblem cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select send server sessions sms snippet soap source space speed sql static structure syntax system table tutorial up-to-date update upload url validation validator variable video web wordpress xml youtube






