Linking to the _parent equivalent from a php iframe

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Acknowlegded
Forum Newbie
Posts: 1
Joined: Wed Feb 23, 2011 12:44 pm

Linking to the _parent equivalent from a php iframe

Post by Acknowlegded »

pickle | Please use [ syntax=php ], [ syntax=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Hi

I have a php page contact form which I've put inside a iframe inside a html page.

http://www.acknowledgedtest.info/quickf ... ctform.php is the page that's in the iframe,

http://www.acknowledgedtest.info/quickfix/contact.html is the main page.

Below if the php at the top of the contactform.php page:

=================

Code: Select all

<?PHP

require_once("./include/fgcontactform.php");
require_once("./include/simple-captcha.php");

$formproc = new FGContactForm();
$sim_captcha = new FGSimpleCaptcha('scaptcha');

$formproc->EnableCaptcha($sim_captcha);

//1. Add your email address here.
//You can add more than one receipients.
$formproc->AddRecipient('mrajsmith2000@yahoo.co.uk'); //<<---Put your email address here


//2. For better security. Get a random tring from this link: http://tinyurl.com/randstr
// and put it here
$formproc->SetFormRandomKey('CnRrspl1FyEylUj');


if(isset($_POST['submitted']))
{
if($formproc->ProcessForm())
{
$formproc->RedirectToURL("index.html");
}
}

?>
==============

At the bottom of the php:

Code: Select all

$formproc->RedirectToURL("index.html");
I need this to load as the main page not inside the iframe. You would of course use target="_parent" or similar for a html page, but how can I achieve this in php?

Any help here who be great thanks.

Regards

Ashley


pickle | Please use [ syntax=php ], [ syntax=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Linking to the _parent equivalent from a php iframe

Post by pickle »

There is no such thing as a php iframe. iframes only exist in markup language like HTML. PHP is the server side language that is used to generate html that is then passed to the browser. The browser never sees, nor has any concept of, PHP. It's a common misconception a lot of new PHP users have.

What does

Code: Select all

$formproc->RedirectToURL("index.html");
? Does it output HTTP headers to redirect?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply