使用标题重定向到其他页面

Here's my situation:

Just a normal form:

<form action="#" method="post" name="frm">

<input type="radio" name="building" value="studio" id="studio" checked/><label for="studio">Studio</label>
<input type="radio" name="building" value="rijwoning" id="rijwoning"/><label for="rijwoning">Maison</label>

<input type="checkbox" name="ek" value="1" id="ek"/><label for="ek">ek</label>
<input type="checkbox" name="epc" value="1" id="epc"/><label for="epc">epc</label>
<input type="checkbox" name="gk" value="1" id="gk"/><label for="gk">gk</label>



<label for="firstname" class="labelcontact">First Name</label><input type="text" name="firstname" id="firstname" class="contactinput"/>
<label for="name" class="labelcontact">Name</label><input type="text" name="name" id="name" class="contactinput"/>

<input class="submitbutton" type="submit" value="Send" alt=""Send/>
    </form>

this is my php code:

<?php 
session_start();

$building = $_POST['building'];
$firstname = $_POST['firstname'];
$name = $_POST['name'];

$escapefirstname = mysqli_real_escape_string($firstname);
$escapename = mysqli_real_escape_string($name);

$value = 0;
$discount = 0;

if (!empty($_REQUEST['ek'])){
    $value = 115;
    $controltype = 'elektrische keuring';
}

if (!empty($_REQUEST['ek']) && !empty($_REQUEST['epc'])){
    $value = 125;
    $controltype = 'elektriciteit, energiecertificaat';
    //$ek_chk = true;
    }


    if (!empty($_REQUEST['epc']) && ($building === 'studio')){  
            $value += 115; 
        }
    elseif (!empty($_REQUEST['epc']) && ($building === 'rijwoning')){ 
            $value += 165;
            $discount = 10;
        }


    if (!empty($_REQUEST['gk'])){
        $value += 130;
    } 

    if (!empty($_REQUEST['ek']) && !empty($_REQUEST['epc']) && !empty($_REQUEST['gk'])){
        $controltype = 'elektriciteit, energiecertificaat, gaskeuring';
    }


    $total = $value - $discount;

$con= mysqli_connect("********","********","***********","***********");

    if (mysqli_connect_errno()) {
    printf("Connect failed: %s
", mysqli_connect_error());
    exit();
    }

$queryorder = 'INSERT INTO `cd_order`
    (`order_building`, `order_firstname`, `order_name`, `order_total`)
VALUES 
("'.$building.'","'.$firstname.'","'.$name.'","'.$total.'")' ;

$result = mysqli_query($con, $queryorder);
        if (!$result) {
        printf("error: %s
", mysqli_error($con));
        }  

$orderid = $con->insert_id;



mysqli_close($con);

    if (!empty($total) && !empty($orderid)){
    $_SESSION['orderid'] = $orderid;
    $_SESSION['total'] = $total;
        header('location: finish.php') ;
    }
    else {
        echo 'error! please try again later!';
    }
?>

My finish page is a pre-made secure page from the people of the payment company i just have to add a dynamic price and a unique ID (from the previous page). thats why i used the $_SESSION.

<?php

    session_start();

    $end_total = $_SESSION['total'] * 100;
    $num_commande = $_SESSION['orderid'];

?>

Everything works, except my "Header" it stays on the form page... i want to be able to send my Variable's ($total & $orderid) from the form page to the finish page after the form is written into my database & my total is been calculated (see code).

Where is my fold (keep in mind that i am in a learning stage of PHP)

Thanks!

you write the wrong syntax 'location' of header.use this code

header('Location: finish.php') ;

Are you saying you want to redirect page from your form page to finish page sending the value of $total and $orderid? If so you can use header function like so:

header('Location: finish.php?total=' . $total . '&orderid=' . $orderid. ');
exit();

After this you can retrievethe $total and $orderid variable values in finish.php