ruạṛ
<?php session_start(); require_once 'scripts-includes/universal.php'; require_once 'scripts-includes/display.php'; $connID = connect_to_db(); $discounts = mysql_query("select * from discount_codes order by start_date desc, code"); if(!$discounts || mysql_num_rows($discounts)<1) { $table = '<p class="center">No discount codes have been defined</p>'; } else { $table = '<table class="control_panel"> <thead> <tr> <th class="pad"></th> <th>Code</th> <th>Discount</th> <th class="username">Start</th> <th class="username">Finish</th> <th class="control">Edit</th> <th class="control">Delete</th> <th class"pad"></th> </tr> </thead> <tfoot></tfoot> <tbody> '; while($d = mysql_fetch_assoc($discounts)) { $did = $d['code_id']; $value = ($d['discount_type']=='$') ? '$'.number_format($d['discount'],2) : number_format($d['discount'],2).'%'; $table .= '<tr> <td> </td> <td>'.$d['code'].'</td> <td>'.$value.'</td> <td>'.date('Y-m-d',$d['start_date']).'</td> <td>'.date('Y-m-d',$d['finish_date']).'</td> <td><a href="edit-discount.php?code='.$did.'">Edit</a></td> <td><a href="processes/process-discount-delete.php?code='.$did.'" onClick="if(confirm(\'Delete '.$d['code'].'?\')){return true}else{return false}" class="delete"><img src="images/img-del.png" alt="Delete" /></a></td> <td> </td> </tr> '; } $table .=' </tbody> </table>'; } head('products','Administration Panel'); ?> <form name="add_discount" id="add_discount" action="processes/process-discount-new.php" method="post" enctype="multipart/form-data" class="add"> <p class="center"> Code: <input name="code" id="code" type="text" size="8" value="" maxlength="8" /> Discount: <input name="discount" id="discount" type="text" size="3" value="" /> <label for="discount_type_%"><input name="discount_type" id="discount_type_%" type="radio" value="%" checked="checked" /> % </label> <label for="discount_type_$"><input name="discount_type" id="discount_type_$" type="radio" value="$" /> $ </label> Start: <input name="start_date" id="start_date" type="text" class="date" size="9" value="<?php echo date('Y-m-d'); ?>" maxlength="10" /> End: <input name="finish_date" id="finish_date" type="text" class="date" size="9" value="<?php echo date('Y-m-d',strtotime('+7 days')); ?>" maxlength="10" /> <input type="submit" name="add" value="Add code" /> </p> </form> <?php echo $table; footer(); exit; ?>
cải xoăn