You can only use header('...');
before any other output. In your case it should be:
<?php //beginning of the file
if (isset($_POST['Submit'])) {
$message = $_POST['message'];
$subject = $_POST['subject'];
$country_id = $_POST['country_id'];
createrow($message, $subject, $country_id);
header('Location: memberprofile.php');
}
.....
?><!DOCTYPE ....
<HTML>....
.....
solved Redirect & Headers already sent [duplicate]