} else {
        foreach ($val as $k => $v) {
            $_POST[$k] = htmlentities($v, ENT_QUOTES);
        }
    }
}
function amountformat($val)
{
    if (is_numeric($val)) {
        if (strpos($val, '$') === false) {
            $val = '$ ' . $val;
        } else {
            $val = $val;
        }
    } else {
        $val = $val;
    }
    return $val;
}
$amount = '';
$date = '';
foreach ($_POST['amount'] as $key => $value) {
    $amount .= amountformat($_POST['amount'][$key]) . '|';
    $date .= $_POST['date'][$key] . '|';
}
$actual = amountformat($actual);
$budget = amountformat($budget);
//echo "insert into `budget` set `user_id`='$id',`item`='$item',`vendor`='$vendor',`budget`='$budget',`actual`='$actual',`amount`='$amount',`date`='$date'".'<br/>';
$db->exec("insert into `budget` set `user_id`='{$id}',`item`='{$item}',`vendor`='{$vendor}',`budget`='{$budget}',`actual`='{$actual}',`amount`='{$amount}',`date`='{$date}'");
$msg = "Inserted Successfully.|0";
header("location:budget?msg={$msg}");
Example #2
0
							      Paid  <?php 
            echo $datearr[$key];
            ?>
							</td>
							
							<td style="color:#e8809f; ">
							       $ <?php 
            echo amountformat($value);
            ?>
							</td>
							<td style="color:#65d0f7;">
								<?php 
            if (count($budarr) - 2 == $key) {
                ?>
								$ <?php 
                echo amountformat($rstmt['actual']) - $total;
                ?>
								<?php 
            }
            ?>
							</td>
						 </tr>
						
						</table> 
					  </td>
				   </tr>
				 <?php 
        }
    }
}
?>