Page 1 of 1

Linking to the _parent equivalent from a php iframe

Posted: Wed Feb 23, 2011 12:48 pm
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.

Re: Linking to the _parent equivalent from a php iframe

Posted: Wed Feb 23, 2011 5:43 pm
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?