-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
63 lines (53 loc) · 1.43 KB
/
Copy pathindex.php
File metadata and controls
63 lines (53 loc) · 1.43 KB
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
<?php
include($_SERVER["DOCUMENT_ROOT"] . "/inc/header.php");
include($_SERVER["DOCUMENT_ROOT"] . "/inc/database.php");
$user_id = 1;
?>
<?php
$hold = "";
try{
$results = $db->prepare("SELECT * FROM gamesave WHERE user_id = ?");
$results->bindParam(1,$user_id);
$results->execute();
$hold = $results->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) {
echo "Data could not be retrieved from the database.";
exit();
}
?>
<div class="mainIndexDiv">
<h1>Play Generations</h1>
<div class="homeDiv">
<form method="post" action="/newgame.php">
<h4>Pick a faction to play as</h4>
<select name="factiontype">
<option value="Romans">Romans</option>
</select>
<h4>Name this game</h4>
<input name="savename" type="text">
<input type="submit" value="Play">
</form>
</div>
<div class="homeDiv">
<form action="/play.php" method="get">
<h4>Load a game</h4>
<select name="id">
<?php
foreach ($hold as $value) {
$id = $value['id'];
$leaderid = $value['leaderid'];
$savename = $value['savename'];
$factiontype = $value['factiontype'];
echo '<option value="'.$id.'">'.$savename.':'.$factiontype.'</option>';
}
?>
</select>
<input name="load" type="submit" value="Load">
<!-- <input name="delete" type="submit" value="Delete"> -->
</form>
</div>
<div style="clear:both;"></div>
</div>
<?php
include($_SERVER["DOCUMENT_ROOT"] . "/inc/footer.php");
?>