-1

Warning: A non-numeric value encountered in /Applications/XAMPP/xamppfiles/htdocs/cmp255/Final/Change Maker/handler.php on line 62

I keep seeing this error when I run my code.
This is line 62

$fiveC = 0.05 * $_POST['fiveCent'];


This is what its getting data from

<p>$0.05<input type="number" name="fiveCent" ></p>

Could I get any help?

Sumithran
  • 6,217
  • 4
  • 40
  • 54

1 Answers1

0

I'd call floatval on your incoming POST parameter to cast that to a float value, whether its a string or float-like.

So try

       $fiveC = 0.05 * floatval($_POST['fiveCent']);
Cody Caughlan
  • 32,456
  • 5
  • 63
  • 68