-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeal.php
59 lines (54 loc) · 2.06 KB
/
meal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require 'config.php';
isUserLoggedIn();
$con = dbConnect();
$details = getMealDetails( $con );
if ( $con ) {
if ( isset( $_REQUEST['addMeal'] ) ) {
$result = addMeal( $_REQUEST, $con );
}
}
?>
<?php require 'header.php' ?>
<?php require 'navbar.php' ?>
<div class="row content">
<div class="twelve columns">
<?php require 'message.php'; ?>
<?php if ( isset( $_GET['user'] ) ) : ?>
<form action="" method="post">
<label for="meal">Meal Time</label>
<input type="checkbox" name="meal[]" value="breakfast"> Breakfast
<input type="checkbox" name="meal[]" value="lunch"> Lunch
<input type="checkbox" name="meal[]" value="dinner"> Dinner
<label for="billProvided">Meal Date</label>
<input class="u-full-width" name="billProvided" type="text" placeholder="Enter date exp:2017-04-30" id="billProvided">
<input type="hidden" name="userid" value="<?php echo $_GET['user']; ?>">
<input name="addMeal" type="submit" value="Add Meal">
</form>
<?php else : ?>
<table class="u-full-width" id='mess-tables'>
<thead>
<tr>
<th>ID</th>
<th>Staff Name</th>
<th>Meal Time</th>
<th>Meal Count</th>
<th>Meal Date</th>
</tr>
</thead>
<tbody>
<?php while ( $row = mysqli_fetch_assoc( $details ) ) : ?>
<tr>
<td><?php echo $row['mm_um_id']; ?></td>
<td><?php echo $row['mm_user_name']; ?></td>
<td><?php echo $row['mm_um_time']; ?></td>
<td><?php $meal = explode( ',', $row['mm_um_time'] ); echo sizeof($meal); ?></td>
<td><?php echo $row['mm_um_date']; ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php endif; ?>
</div>
</div>
<?php require 'footer.php' ?>