It's my pleasure to join the members of this great forum.

Basically, in the following code:

$hostname = '';
$username = '';
$password = '';
$dbn = '';
try {
$dbh = mysqli_connect($hostname , $username, $password ,$dbn);
//echo 'Connected to database';
catch(PDOException $e)
echo $e->getMessage();
if (isset($_POST['formsubmitted'])) {
$fullname = $_POST['fullname'];
$username = $_POST['username'];
$email1 = $_POST['email1'];
$password1 = $_POST['password1'];
$dob = $_POST['dob'];
$query_verify_email = "SELECT * FROM User  WHERE Email = '$email1'";
$result_verify_email = mysqli_query($dbh, $query_verify_email);
if (!$result_verify_email) {//if the Query Failed ,similar to             if($result_verify_email==false)
echo ' Database Error Occured ';
if (mysqli_num_rows($result_verify_email) == 0) { // IF no previous user is using this     email .
// Create a unique  activation code:
$activation = md5(uniqid(rand(), true));
//$id= uniqid();
$query_insert_user = "INSERT INTO `User` ( `Name`, `Username`, `Email`, `Password`,     `DOB`, `Activation`) VALUES ( '$fullname', '$username', '$email1', '$password1', '$dob',     '$activation')";
$result_insert_user = mysqli_query($dbh, $query_insert_user);
if (!$result_insert_user) {
echo 'Query did not work ';
if (mysqli_affected_rows($dbh) == 1) { //If the Insert Query was successfull.
// Send the email:
$message = " To activate your account, please click on this link:\n\n";
$message .= 'http://website' . '/active.php?email=' . urlencode($email1) . "&key=$activation";
mail($email1, 'Registration Confirmation', $message, 'From: a@b.com');
// Flush the buffered output.
// Finish the page:
echo '<div class="success">Thank you for registering! A confirmation email has been     sent to '.$email1.' Please click on the Activation Link to Activate your account </div>';
} else { // If it did not run OK.
echo '<div class="errormsgbox">You could not be registered due to a system error. We     apologize for any inconvenience.</div>';
} else { // The email address is not available.
echo    '<div class="errormsgbox" >That email address has already been registered.
mysqli_close($dbh);//Close the DB Connection
}// End of the main Submit conditional.
    <form name="f1" action="Main.php" method="post">
        <p>Full name: <br/><input class="tb10" type="text" name="fullname" /></p>
        <p>Username: <br/><input class="tb10" type="text" id="username"     name="username" /><br/>
        <p>Email: <br/><input class="tb10" type="text" id="email1" name="email1" /></p>
        <p>Re-Enter Email: <br/><input class="tb10" type="text" name="email2" /></p>    <br/>
        <p>Password: <br/><input class="tb10" type="password" name="password1" /></p>
        <p>Re-Enter Password: <br/><input class="tb10" type="password" name="password2"     /></p><br/>
        <p>Date of Birth: <br/><input class="tb10" type="text" name="dob" /></br><img     src="img/calendar1.gif" alt="Calendar"     onclick="displayCalendar(document.forms[0].dob,'yyyy/mm/dd',this)"/></p><br/>
        <div class="submit">
            <input type="hidden" name="formsubmitted" value="TRUE" />
            <input type="submit" value="Submit" class="button" />
The problem is I want to show the message that show up in the top (before the html part) in the body part. That means when the user completes the registration, the message will show up instead of the fields in the body section (Name, UserName, Email ,....).

To illustrate it:

If the registration is valid, I want the message:

Thank you for registering! A confirmation email has been     sent to '.$email1.' Please click on the Activation Link to Activate your account
Appears in the body part (instead of the fields).

I hope you understand my explanation.