I have been working on this form to the best of my abilities. I had it programmed in javascript but I do not know php. The code below is my best try but I cant seem to get it to work. I receive a couple errors and all results are 0. Any help is greatly appreciated.
Code:<?php $GASPrice = strip_tags($_POST["GASPrice"]); $Ethanol = strip_tags($_POST["Ethanol"]); $MPGGAS = strip_tags($_POST["MPGGAS"]); $Tank = strip_tags($_POST["Tank"]); $MPGE85= strip_tags($_POST["MPGE85"]); if ($MPGE85 <= 0) $E85Percent = ($MPGGAS / ($MPGGAS * .87)); else $E85Percent = ($MPGGAS / $MPGE85); $GASTank = ($GASPrice * $Tank); $E85 = ($Ethanol * 2) / 2; $E85TankNon = ($E85 * $Tank); $E85Tank = (($E85 * $Tank) * $E85Percent); $GasSaveTank = ($E85Tank - $GASTank); $GasSaveGall = ($E85Tank - $GASTank) / $Tank; $E85SaveTank = ($GASTank - $E85Tank); $E85SaveGall = ($GASTank - $E85Tank) / $Tank; $Diff = (GASTank - E85Tank); $SaveTankGas = "$" + round($GasSaveTank,2); $SaveGallGas = "$" + round($GasSaveGall,2); $SaveTankE85 = "$" + round($E85SaveTank,2); $SaveGallE85 = "$" + round($E85SaveGall,2); $E85Tank1 = "$" + round($E85Tank,2); $GASTank1 = "$" + round($GASTank,2); $E85TankNon1 = "$" + round($E85TankNon,2); if (Diff <= 0) echo "<table> <tr> <td colspan=2 align=center>Your best choice is using Gasoline.</td> </tr> <tr> <td>Savings per tank</td> <td>" . $SaveTankGas . "</td> </tr> <tr> <td>Savings per gallon</td> <td>" . $SaveGallGas . "</td> </table>"; else echo "<table> <tr> <td colspan=2 align=center>Your best choice is using E85.</td> </tr> <tr> <td>Savings per tank</td> <td>" . $SaveTankE85 . "</td> </tr> <tr> <td>Savings per gallon</td> <td>" . $SaveGallE85 . "</td> </tr> </table>"; echo "<table> <tr> <td>Cost to fill up with Gasoline</td> <td>" . $GASTank1 . "</td> </tr> <tr> <td>Cost to fill up with E85</td> <td>" . $E85Tank1 . "</td> </tr> <tr> <td>Cost to fill up with E85 *Adjusted Price</td> <td>" . $E85TankNon1 . "</td> </tr> </table>"; echo "* Adjusted Price : The adjusted price includes the extra cost due to loss in fuel mileage."; ?>


LinkBack URL
About LinkBacks
Reply With Quote


