Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirecting to other page with header
    primarykey
    data
    text
    <p>Here's my situation:</p> <p>Just a normal form: </p> <pre><code>&lt;form action="#" method="post" name="frm"&gt; &lt;input type="radio" name="building" value="studio" id="studio" checked/&gt;&lt;label for="studio"&gt;Studio&lt;/label&gt; &lt;input type="radio" name="building" value="rijwoning" id="rijwoning"/&gt;&lt;label for="rijwoning"&gt;Maison&lt;/label&gt; &lt;input type="checkbox" name="ek" value="1" id="ek"/&gt;&lt;label for="ek"&gt;ek&lt;/label&gt; &lt;input type="checkbox" name="epc" value="1" id="epc"/&gt;&lt;label for="epc"&gt;epc&lt;/label&gt; &lt;input type="checkbox" name="gk" value="1" id="gk"/&gt;&lt;label for="gk"&gt;gk&lt;/label&gt; &lt;label for="firstname" class="labelcontact"&gt;First Name&lt;/label&gt;&lt;input type="text" name="firstname" id="firstname" class="contactinput"/&gt; &lt;label for="name" class="labelcontact"&gt;Name&lt;/label&gt;&lt;input type="text" name="name" id="name" class="contactinput"/&gt; &lt;input class="submitbutton" type="submit" value="Send" alt=""Send/&gt; &lt;/form&gt; </code></pre> <p>this is my php code:</p> <pre><code>&lt;?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']) &amp;&amp; !empty($_REQUEST['epc'])){ $value = 125; $controltype = 'elektriciteit, energiecertificaat'; //$ek_chk = true; } if (!empty($_REQUEST['epc']) &amp;&amp; ($building === 'studio')){ $value += 115; } elseif (!empty($_REQUEST['epc']) &amp;&amp; ($building === 'rijwoning')){ $value += 165; $discount = 10; } if (!empty($_REQUEST['gk'])){ $value += 130; } if (!empty($_REQUEST['ek']) &amp;&amp; !empty($_REQUEST['epc']) &amp;&amp; !empty($_REQUEST['gk'])){ $controltype = 'elektriciteit, energiecertificaat, gaskeuring'; } $total = $value - $discount; $con= mysqli_connect("********","********","***********","***********"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", 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\n", mysqli_error($con)); } $orderid = $con-&gt;insert_id; mysqli_close($con); if (!empty($total) &amp;&amp; !empty($orderid)){ $_SESSION['orderid'] = $orderid; $_SESSION['total'] = $total; header('location: finish.php') ; } else { echo 'error! please try again later!'; } ?&gt; </code></pre> <p>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. </p> <pre><code>&lt;?php session_start(); $end_total = $_SESSION['total'] * 100; $num_commande = $_SESSION['orderid']; ?&gt; </code></pre> <p>Everything works, except my "Header" it stays on the form page... i want to be able to send my Variable's ($total &amp; $orderid) from the form page to the finish page after the form is written into my database &amp; my total is been calculated (see code).</p> <p>Where is my fold (keep in mind that i am in a learning stage of PHP)</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload