I have built a jquery mobile form that submits to a php file. I want the following php output to also have the option of emailing it to the user.
<?php
$DCity=$_GET["DCity"];
$ACity=$_GET["ACity"];
date_default_timezone_set($DCity);
$DZone = date("Y-m-d h:i:s A");
date_default_timezone_set($ACity);
$AZone = date("Y-m-d h:i:s A");
echo ((strtotime($DCity) - strtotime($ACity))/3600)." hour Timezone Difference</br>";
?>
This will output something like "5 hour Timezone Difference". Below this php I have a this code which should save the output for an email.
<?php
ob_start();
$DCity=$_GET["DCity"];
$ACity=$_GET["ACity"];
date_default_timezone_set($DCity);
$DZone = date("Y-m-d h:i:s A");
date_default_timezone_set($ACity);
$AZone = date("Y-m-d h:i:s A");
echo ((strtotime($DCity) - strtotime($ACity))/3600)." hour Timezone Difference</br>";
$var=ob_get_flush();
?>
The user then has the option to email this to themselves. If they click the link it takes them to a new form to enter in their email address which posts to a new php that contains this code.
<?php
$to = $_GET["email"];
$subject = "Your Personalized JetLag Pilot Plan";
require 'OriginalOutput.php';
$body = $var;
mail($to,$subject,$body);
echo "Mail sent to $to";
?>
The original php output is working correctly. However whenever I send an email that should contain the same output, it always says "0 hour Timezone Difference." The email form is working correctly just not carrying the OriginalOutput.php. Anyone know where my mistake is?