Delete and redirect to the page in php
<p>I am trying to delete the entry in php and redirect the page in php.
I need to redirect the page based on condition as <code>header("Location: report2.php?region=$region");</code> after deletion page doesnt get redirected to <code>header("Location: report2.php?region=$region");</code> 
It doesnt delete also. It only redirects to report2.php?delete_id=103
Here is the code</p>

<pre><code>  ?php
//Give your mysql username password and database name
include_once "db.php";
if(isset($_REQUEST['region']))
{
$region=$_REQUEST['region'];

//connection to the database


$qresult = mysql_query("SELECT * FROM registration where region='".$region."'");

    echo "&lt;h1&gt;Registration Details of $region Region.&lt;/h1&gt;";
if (mysql_num_rows($qresult) == 0) { 
echo "&lt;h3 style=color:#0000cc;text-align:center;&gt;No Registrations Done..!&lt;/h3&gt;"; 
} else { 


        echo "&lt;table border='1' cellpadding='0' cellspacing='0' class='reports'&gt;";

        echo "&lt;tr&gt;" .
                    "&lt;td style='background: #f1f1f1; font-weight: bold;text-align:center;'&gt;Registration Number&lt;/td&gt;" .
                    "&lt;td style='background: #f1f1f1; font-weight: bold;text-align:center;'&gt;Name&lt;/td&gt;" . 
"&lt;/tr&gt;";

        while($row = mysql_fetch_assoc($qresult)) { 
                       echo "&lt;tr&gt;" .
                    "&lt;td style=text-align:center;&gt;" . $row['id'] . "&lt;/td&gt;" . 

                    "&lt;td style=text-align:center;&gt;".  $row['name']  . "&lt;/td&gt;"; 


                ?&gt;

              &lt;td&gt;&lt;a href="javascript:delete_id(&lt;?php echo $row['id']; ?&gt;)"&gt;&lt;img src="images/delete21.png" alt="Delete" /&gt;&lt;/a&gt;&lt;/td&gt;


                    &lt;/tr&gt;
        &lt;?php   
        }
        }}
        ?&gt;
        &lt;/table&gt;
 &lt;?php
 if(isset($_GET['delete_id']))
  {
    $sql_query="DELETE FROM registration WHERE id=".$_GET['delete_id'];
    mysql_query($sql_query);

    header("Location: report2.php?region=$region");
    exit;
  }

?&gt;  
</code></pre>