-2
 $number=$_REQUEST['number'];
 $price=$row2['costpeople'];
 $endprice=$price*$number;

number is the name of input, type of this input is "TEXT" and costpeople is a field of database that type of this field is decimal. when multiply Between price and number and echo $endprice don't show the value of $endprice. This means that don't multiply Between them, please help me. its Necessary for me.

Neda
  • 57
  • 6

2 Answers2

1
$number = floatval($_REQUEST['number']);
$price = $row2['costpeople'];
$endprice=$price*$number;

you can use floatval(), intval() to convert string to number.. source

You can also do type cast

Shaunak Shukla
  • 2,347
  • 2
  • 18
  • 29
0

There is no issue of TEXT here my sample code working fine and return me output well.

$a = "5.5";
$b = "5";
echo $a*$b;
//Result 27.5
Sadikhasan
  • 18,365
  • 21
  • 80
  • 122