wiiner Posted March 6, 2010 Share Posted March 6, 2010 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 " "; } ?> </td> </tr> Link to comment https://forums.phpfreaks.com/topic/194304-decimal-point/ Share on other sites More sharing options...
MatthewJ Posted March 6, 2010 Share Posted March 6, 2010 Well, first off you will need to remove this as it is removing the decimal $ketas=str_replace(".", '', str_replace(".", '', $_POST["ketas"])); and I'm not sure why you would be doing it twice Link to comment https://forums.phpfreaks.com/topic/194304-decimal-point/#findComment-1022190 Share on other sites More sharing options...
wiiner Posted March 6, 2010 Author Share Posted March 6, 2010 Thank you! Link to comment https://forums.phpfreaks.com/topic/194304-decimal-point/#findComment-1022226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.