forms - Emailing php output -
i have built jquery mobile form submits php file. want following php output have option of emailing 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 output "5 hour timezone difference". below php have code should save output 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 has option email themselves. if click link takes them new form enter in email address posts new php contains code.
<?php $to = $_get["email"]; $subject = "your personalized jetlag pilot plan"; require 'originaloutput.php'; $body = $var; mail($to,$subject,$body); echo "mail sent $to"; ?> the original php output working correctly. whenever send email should contain same output, says "0 hour timezone difference." email form working correctly not carrying originaloutput.php. know mistake is?
Comments
Post a Comment