Jump to content

Vibralux

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Vibralux's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Vibralux

    mySQL?

    Are you on shared hosting?
  2. with the sprintf i get no output at all. Also is that the correct way to be doing it as im soon going to be rounding it up.
  3. No, as above i got told to get rid of the int. Shall i put it back? BTW, i cant get it to output a number with the sprintf
  4. ok here is the webpage http://www.matt.no1-host.co.uk/index.php type in 4.99 into the top box then for the date type 20/07/2007 The second line down, where is says The price without VAT is ..... at the end of the number it will have E-06
  5. The second line is this command if (isset($_POST["calculate"])) echo "The price without VAT is $price <br>"; And with the round up and roun down. I need it to work it out its self whether it needs to round it up or round it down. Do i do and if statement for this?
  6. ok, this is what i have now </div> <h3 align="center" class="style1"> Instructions </h3> <div align="center"><span class="style1"> <div align="center" class="style1">Please fill in the cost per month with the price not including VAT.<br> The Date of Renewal must be as such - 01 01 2000 <table width="400px" style="border" bgcolor="#808080"> </span> </div> </div> <tr> <td> <P align="center"> <form method='post'> <div align="center"> <div align="center"><span class="style1">Cost per month </span> <input type=text name=cpm> <br> <span class="style1">Date of Renewal: Day</span> <input type=text maxlength=2 size=2 name=rday> <span class="style1">Month</span> <input type=text maxlength=2 size=2 name=rmonth> <span class="style1">Year</span> <input type=text maxlength=4 size=2 name=ryear> <br> <input type=submit name='calculate' value='Calculate'> <input type=reset name='reset' value='Reset'> <?php if (isset($_POST["calculate"]) && $cpm='') echo "Please enter a number into the Cost per month box"; $todaysdate = time(); if (isset($_POST["calculate"]) && $rday=''){ echo "Please enter a numberinto the Renewal Day Date.";} if (isset($_POST["calculate"]) && $rmonth=''){ echo "Please enter a numberinto the Renewal Month Date.";} if (isset($_POST["calculate"]) && $ryear=''){ echo "Please enter a numberinto the Renewal Year Date.";} $costpermonth = $_POST[cpm]; $renewalday = $_POST[rday]; $renewalmonth = $_POST[rmonth]; $renewalyear = $_POST[ryear]; $renewalseconds = mktime(0, 0, 0, $renewalmonth, $renewalday, $renewalyear, 0); $timedifference = $renewalseconds - $todaysdate; $VAT = ($costpermonth/100)*17.5; $price = $costpermonth / $timedifference; $totalprice = $price + $VAT; //Output final calculations echo"<br>"; echo"<br>"; echo"<br>"; if (isset($_POST["calculate"])) {echo "The total price is $totalprice <br>"; if (isset($_POST["calculate"])) echo "The price without VAT is $price <br>"; if (isset($_POST["calculate"])) echo "The VAT is $VAT <br>";} ?> </div> It works fine except i get E-06 on the end of the second number. Also how do i round it up to a whole number as its going to be money as you can proberbly work out.
  7. OK, the calculations work now. But it comes up with the print_r bit which i dont want. It says i have to have somthing in there so what do i have in there? Also, now the calculations work when i click calculate i get the numbers but i get an E-06 at the end of the number. Does any one know what this is/means?
  8. The code is supposed to be taking what is put into the form out of the form and then play with it. I want to find out how much its gonna cost to upgrade a server or somthing in the middle of a persons contract. The script should automatically get todays date and then get the date that was inputted into the form. Then it should take those away from each other to give somthing that i can use later. Then it does some more calculations. Then it should ouput them in an echo.
  9. Right Guys, I have this code and for some reason its not working. Can any of you spot any mistakes or somthing missing? <h3 align="center" class="style1"> Instructions </h3> <div align="center"><span class="style1"> <div align="center" class="style1">Please fill in the cost per month with the price not including VAT.<br> The Date of Renewal must be as such - 01 01 2000 <table width="400px" style="border" bgcolor="#808080"> </span> </div> </div> <tr> <td> <P align="center"> <form method='post'> <div align="center"> <div align="center"><span class="style1">Cost per month </span> <input type=text name=cpm> <br> <span class="style1">Date of Renewal: Day</span> <input type=text maxlength=2 size=2 name=rday> <span class="style1">Month</span> <input type=text maxlength=2 size=2 name=rmonth> <span class="style1">Year</span> <input type=text maxlength=4 size=2 name=ryear> <br> <input type=submit name='calculate' value='Calculate'> <input type=reset name='reset' value='Reset'> <?php if (isset($_POST["calculate"]) && $cpm='') echo "Please enter a number into the Cost per month box"; $todaysdate = time(); if (isset($_POST["calculate"]) && $rday=''){ echo "Please enter a numberinto the Renewal Day Date.";} if (isset($_POST["calculate"]) && $rmonth=''){ echo "Please enter a numberinto the Renewal Month Date.";} if (isset($_POST["calculate"]) && $ryear=''){ echo "Please enter a numberinto the Renewal Year Date.";} $costpermonth = $_GET[cpm]; $renewalday = $_GET[rday]; $renewalmonth = $_GET[rmonth]; $renewalyear = $_GET[ryear]; $renewalseconds = mktime(0, 0, 0, $renewalmonth, $renewalday, $renewalyear, 0); $timedifference = $renewalseconds - $todaysdate; $VAT = (int)($costpermonth/100)*17.5; $price = $costpermonth / $timedifference; $totalprice = $price + $VAT; //Output final calculations echo"<br>"; echo"<br>"; echo"<br>"; print_r('$VAT, $price, $totalprice'); if (isset($_POST["calculate"])) {echo "The total price is $totalprice";} echo"<br>"; if (isset($_POST["calculate"])) {echo "The price without VAT is $price";} echo"<br>"; if (isset($_POST["calculate"])) {echo "The VAT is $VAT";} echo"<br>"; ?> </div> Im not sure if ive used time and mktime wrong. Please help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.