Total: $ Notice: Undefined variable: totalCost in C:\wamp\www\shoes\stores\cart.php on line 151 0.00 <tr> <td colspan="2"> <font face="verdana" size="1" color="black"> <a href="itemdetails.php"><< Keep Shopping</a></font></td> <td colspan="2"> <font face="verdana" size="2" color="black"> <b>Total: $<?php echo number_format($totalCost, 2, ".", ","); ?></b>// line 151 </font></td> </tr> <tr> PHP: What could that be and where could I define it
Just say $totalCost = ''; somewhere before you call it in numberformat (or anywhere else before it's defined). strictly speaking you don't have to, it's only a warning. or you could say @number_format($totalCost, 2, ".", ","); PHP: or at the start of your php script you could use: error_reporting(0); PHP:
Use isset($totalCost) to check if it is defined or not. If yes then put ur code else do something else.
You should give more info about the page / script. What are you trying to do ? Where io you calculate $totalCost ?