PHP Results Page

oculusmm 24 Jan, 2012
Hi,

I have created a number of calculators in PHP and just curious as to how to go about the following in Chronoforms.

I have built forms where users input data and on submit the results go to a new page where users can see for example their expected salary/mortgage etc... Is it therefore possible to send POST data to a new page where the calculations are completed? Below for example is a small example of one of the results pages..

<?php
  $first_name = $_POST['firstname'];
  $last_name = $_POST['lastname'];
  $email = $_POST['email'];
  $salesrevenue = $_POST['salesrevenue'];
  $costs = $_POST['costs'];
  
  $grossprofit = $salesrevenue - $costs;
  $grossprofitmargin = ($grossprofit / $salesrevenue) * 100;
  
/*
  $dbc = mysqli_connect('localhost', 'database_user', 'database_pass', 'vatcalculator')
    or die('Error connecting to MySQL server.');

  $query = "INSERT INTO vat_calculator (first_name, last_name, email) " .
    "VALUES ('$first_name', '$last_name', '$email')";

  $result = mysqli_query($dbc, $query)
    or die('Error querying database.');

  mysqli_close($dbc);
*/
  echo 'Thanks for submitting the form.<br />';
  echo 'Gross Profit £: ' . number_format(grossprofit, 2)  . '<br />';
  echo 'Gross Profit Margin £: ' . number_format($grossprofitmargin, 2) . '<br />';
  echo 'Your first name: ' . $first_name . '<br />';
  echo 'Your last name: ' . $last_name . '<br />';
  echo 'Your email address is: ' . $email;
?>
This topic is locked and no more replies can be posted.