# PHP redirect script keeps opening a new tab

**URL:** https://forum.kirupa.com/t/php-redirect-script-keeps-opening-a-new-tab/288203
**Category:** Uncategorized
**Created:** [May 12, 2009, 6:57pm UTC](https://forum.kirupa.com/t/php-redirect-script-keeps-opening-a-new-tab/288203 "2009-05-12T18:57:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![crazy\_clairey](https://avatars.discourse-cdn.com/v4/letter/c/e47c2d/32.png) [@crazy\_clairey](https://forum.kirupa.com/u/crazy_clairey)
#### Post date: [May 12, 2009, 6:57pm UTC](https://forum.kirupa.com/t/php-redirect-script-keeps-opening-a-new-tab/288203/1 "2009-05-12T18:57:40Z")

</div>

Hi there,

I have a simple email php script. What I want it to do is redirect after the email is sent to the hompepage. It is doing this but it opens the homepage in a new tab!

Can anyone advise me on why it’s doing this? I need it to open in the same window.

Here’s my code below:

```php

<?
$sendTo = "info@myemail.com";
$subject = "Website Form:";

 

$name=$_POST['theName'];
$email=$_POST['theEmail'];
$imageurl = $_POST["imageURL"];
$filename = $_POST["imageFilename"];
$imageuniqueid = $_POST["imageuniqueID"];

$sendTo = 'info@myemail.com';
$subject = "Website Form: $name $email ";
$message = "$filename $imageuniqueid $imageurl";

mail($sendTo, $subject, $message); 
header("Location: index.html");

?> 

```

Can anyone shed any light on this? Any help would be greatly appreciated!! Thankyou!!! 🙂
