zero-perfoliate
zero-perfoliate

Author Topic: Decimal point  (Read 164 times)

Offline wiiner

  • New PHP Members
  • Posts: 1
  • Karma: +0/-0
Decimal point
« on: March 05, 2010, 05:11:43 PM »
To be honest, I donīt really understand what I have done. But understand what my problem is.
Here is my page: http://kymnevoistlus.clanteam.com/ennusta.php

The problem is you can insert only integer numbers, but I need to change that it would be possible to insert numbers like 11.4 .

Thank you for helping.

Here is the problematic part of the code:
   <tr>
         <td>
            ketas:
         </td>
         <td>
            <input type="text" name="ketas" value='<?php if(isset($_POST["ketas"])){echo $_POST["ketas"];}else{ echo "";} ?>' />
         </td>
                        <td>
                                <?php
               if(isset($_POST["arvuta1"])){
                  $ketas=str_replace(".", '', str_replace(".", '', $_POST["ketas"]));
                  
                  if(is_numeric($_POST["ketas"])){         
                     if($ketas==0){
                        echo "viga numbri valimisel...";
                     }else{
                        $tulemus7=(12.91*(pow(($ketas-4.0), 1.1)));
                        echo (int) "$tulemus7";
                     }         
                  }else{
                     echo "viga numbri valimisel...";
                  }
               }else{
                  echo "&nbsp;";
               }
            ?>
         </td>         
      </tr>