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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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