function add_sp($id) { $db = conn(); $agencyid = $_SESSION['userData']['agencyID']; $date = find_subplan(); if (empty($date)) { $sdate = date('Y-m-d'); } else { foreach ($date as $s) { $sdate = $s['endDate']; } } $wdate = new DateTime($sdate); $wdate->add(new DateInterval('P30D')); $edate = $wdate->format('Y-m-d'); $type = 'A'; $db->exec("INSERT INTO subscriptions(SPID, subscriberID, startDate, endDate, subtype)VALUES('" . $id . "','" . $agencyid . "','" . $sdate . "','" . $edate . "','" . $type . "')"); $db = null; }
<?php include_once 'database.php'; $plan = find_subplan(); ?> <!DOCTYPE html> <html> <head> <title></title> </head> <body> <h2>Your Plan</h2> <hr/ > <?php foreach ($plan as $p) { ?> <span style="font-weight:bold;"><?php echo $p['SPName']; ?> </span> <span class="pull-right"><?php echo "start date: " . $p['startDate']; ?> </span> <div> <span><?php echo $p['description']; ?> </span> <span class="pull-right"><?php