Jump to content


Photo

Open PHP page in Parent window...


  • Please log in to reply
6 replies to this topic

#1 obaluba

obaluba
  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 14 August 2006 - 04:50 PM

Hi,

I think this is fairly simple although I have been tearing my hair out all day! Basically.. I have a html page which has an iframe on it which loads a php page which contains a form. Once the form is filled out I have this code to return it to another html page. currently the html page is loading in the iframe, I need to find a way to make it load in the parent of the iframe if you like...

The code I have is below for this section...

$ThankYou = $_GET['ThankYou'];
if ($ThankYou != "") {
    $message    = "Thankyou, you will now be forwarded to the technical section.";

header("HTTP/1.1 301 Moved Permanently");
header ("Location: http://www.google.com");
}

I tried adding this having found it on another site:
header("target_parent");

but didnt seem to work

any help would be greatly appreciated  :)

thanks

#2 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 14 August 2006 - 04:53 PM

would be better if you use $_SERVER['HTTP_REFERER']; and thats headers part not PHP
I am a PHP Guru, ask me questions if you want to

#3 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 14 August 2006 - 04:59 PM

I think that what you would need to do is nothing to do with PHP but is to do with your POST you need to POST to the parent frame and then let that process and change the header location as using headers changes that single file e.g. inside the iframe instead of what you want which is the actual page the user see's

Maby there is some javascript you can use to do this if you ask in JS forum?

Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#4 obaluba

obaluba
  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 14 August 2006 - 05:11 PM

Is there no way it can be done in the PHP posted, nothing that can be put in the header section? I'm a total novice at PHP, so my knowledge is primative at best!! :)

#5 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 14 August 2006 - 05:15 PM

PHP is though dynamic it can only give the browser a HTML code it can though be like a software but it cant control the browser.
I am a PHP Guru, ask me questions if you want to

#6 obaluba

obaluba
  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 14 August 2006 - 05:18 PM

could i use some javascript on my php page (the one i posted a bit of above) to get it to open in the parent window do you think? does PHP and JS work together in that way?

thanks, sorry for the novice questions!

#7 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 14 August 2006 - 05:21 PM

You can generate JS from PHP but they dont work together.
I am a PHP Guru, ask me questions if you want to




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users