标题不起作用

Am having problem with header no returning to the page specified.The update work well, but instead of returning to profile.php, the up.php file will display blank page. up.php is the name of the file displayed below. please help me, have checked for the white space, i can not fix it

<?php   
include('../_includes/configg.php');
session_start();
$id=$_SESSION['uid'];
 ?>
<?php 
$phone= $_POST['phone'];
$phone2= $_POST['phone2'];
$address       = $_POST['address'];
$fname= $_POST['fname'];
$sname       = $_POST['sname'];

//  turn autocommit off
mysqli_autocommit($link, FALSE);

// Insert data into mysql
$sql = "update trader set address='$address', phone='$phone', phone2='$phone2', sname='$sname', fname='$fname' where id= '$id'";
$result = mysqli_query($link, $sql); 

// if successfully insert data into database, displays message "Successful".
if($result){
// Am having problem here is not returning to profile.php.
    header('Location:profile.php');
}
else {
    echo "ERROR";
}
mysqli_commit($link);
mysqli_close($link);
?> 

First of all, use PDO::Mysql instead of deprecated mysql uses. Also, your SQL queries are full of sql injections, always sanitize your user input.

Now, why doesn't your header work? Because header edits the headers send with the page. After the headers comes the data. At the moment your PHP page is processing data (you end your PHP code, leave some blank and than start the <?php code again, so data output has been generated.) Try leaving the ?> and <?php out of the code.

session_start();
$id=$_SESSION['uid'];
$phone= $_POST['phone'];
$phone2= $_POST['phone2'];

Also make sure your include('../_includes/configg.php'); doesn't contain any data that will be send to the user (so leave the ?> out of it so it won't compile as a page).