Jump to content

PostData Header "Target"?


the_real_JLM

Recommended Posts

as seen in my earlier thread answered by Ken (thanks), I am using header to redirect after submitting a form. I need the redirect to open in the parent window, not the current frame.

 

Here is what I tried, and failed ofcourse :)

 

<?php
$post_array = array('name' => '', 'drivers' => 'Drivers License: ',
                    'position' => 'Position Applying For: ', 'address' => 'Address: ', 'message' => '');
if (isset($_POST['submit'])) {
  $email = $_POST['email'] ;
  $tmp = array();
  $tmp['name'] = '';
  foreach ($_POST as $key => $val)
     switch($key) {
        case 'firstname':
        case 'lastname':
            $tmp['name'] .= $val . ' ';
            break;
        case 'email':
            $email = stripslashes($val);
            break;
        case 'submit':
            break;
        default:
            $tmp[$key] = trim(stripslashes($val));
     }
  $tmp2 = array();
  foreach ($post_array as $key => $lbl)
        $tmp2[] = ($lbl != '')?$lbl . stripslashes($tmp[$key]):$tmp[$key];

  mail( "[email protected]", "Online Job Application",implode("\n",$tmp2)."\n" , "From: $email" );
header( "Location: http://blah.com/index.php" target='_Parent' );}
?>

Notice at the end I added target='_Parent', to no avail :)

Link to comment
https://forums.phpfreaks.com/topic/98025-postdata-header-target/
Share on other sites

Maybe if we got into a really long discussion about what CMS you're using, how the page is formatted, etc. we might come up with something really sloppy or even something really good. I don't know.

 

The one suggestion that I can make to you is, have the header redirect to a thankyou.php page or something that would show up inside the frame. Have some text and put a link right underneath it that is formatted exactly how you need it.

 

Thank you for filling out our form. Blah blah blah.

<a href="index.php" target="_parent">Please click here or this page will self destruct.</a>

 

How does that fit your fancy? ;) lol

Maybe if we got into a really long discussion about what CMS you're using, how the page is formatted, etc. we might come up with something really sloppy or even something really good. I don't know.

 

The one suggestion that I can make to you is, have the header redirect to a thankyou.php page or something that would show up inside the frame. Have some text and put a link right underneath it that is formatted exactly how you need it.

 

Thank you for filling out our form. Blah blah blah.

<a href="index.php" target="_parent">Please click here or this page will self destruct.</a>

 

How does that fit your fancy? ;) lol

Yea I was just thinking that. I'll make one with an auto redirect body tag, assuming specifying parent works in that :o lol

 

thx for ur input

got it beat:

<html>
<head><meta http-equiv="refresh" content="2;url=javascript:window.open('index.php','_parent');">
<title>Job Application</title>
</head>
<p align="center">Application recieved, redirecting to main Hodder.ca index...<br>
Please click <a href="index.php" target="_parent">here</a> if this takes longer than 10 seconds. </p>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.