Jump to content

[SOLVED] limiting the number of decimals


alin19

Recommended Posts

<?php

 

if($_SERVER['REQUEST_METHOD'] == 'POST')

 

  {

  $a = $_POST['unu'];

  $b = $_POST['doi'];

  $x = $a*$b;

  }

 

?>

<html>

<body BACKGROUND="mapa2.jpg">

<form name="check" method="post">

</br></br></br></br></br></br>

<table width="304" border="2" cellpadding="0" cellspacing="2"  align="center">

  <!--DWLayoutTable-->

 

  <tr><td id="sapte"/></td></tr>

 

  <tr> <td border="0">test</td><td valign=""align="center" ><font color="red" size="3">Ultimul Pret de Inchidere</font></td>

    <td width="304" height="79" valign="" align="center">

      <input name="unu" type="text" id="unu" />

    </td><td>

  </tr>

  <tr><td border="0">test</td> <td valign=""><font color="red" size="3" align="center">Actiuni gratuite de primit</font></td>

    <td height="86" valign="" align="center" ><input name="doi" type="text" id="doi" /></td>

  </tr>

  <tr><td border="0">test</td>  <td valign="" align="center" ><font color="red" size="3" align="green"></font></td>

    <td height="86" valign="" align="center"><input type="submit" name="CALCULEAZA" value="CALCULEAZA" /></td>

  </tr>

    <tr><td border="0">test</td> <td valign="" align="center" ><font color="red" size="3" align="green">Pret ex-dividend</font></td>

    <td height="35" valign="" align="center"><font color="green" size="8" ><?php if(isset($x)) { echo $x; }

  ?> </font></td>

  </tr>

</table>

</form>

</html>

 

i need x to write only 2 decimals,

how can i do that?

Link to comment
https://forums.phpfreaks.com/topic/76505-solved-limiting-the-number-of-decimals/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.