-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollection.php
34 lines (34 loc) · 1.48 KB
/
collection.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
<?php
$pagetitle = "Add Collection";
include_once ('header.php');
if (isset($userid)){
echo '<BODY onLoad="document.fpcform.collection.focus()">';
$fpcname = (isset($_POST['collection']) ? $_POST['collection'] : null);
$fpcname = mysqli_real_escape_string($con, $fpcname);
$sqlfpcname = "INSERT INTO funkopops.popcollection (popcollection) VALUES ('$fpcname')";
if (!empty($fpcname)) {
if (!$result = $con->query($sqlfpcname)){
die ('There was an error running the query [' . $con->error . ']');
}
echo 'You have successfully entered ' . $fpcname . ' into the database!<BR />';
echo 'Refreshing page in 2 seconds to add another pop collection group.<BR />';
header("refresh:2;url=collection.php");
} else {
echo '<TABLE BORDER="0">';
echo '<FORM METHOD="POST" ACTION="collection.php" NAME="fpcform"><TR><TD>Collection Name: <INPUT TYPE="TEXT" NAME="collection" SIZE="25"></TD></TR>';
echo '<TR><TD><CENTER><INPUT TYPE="SUBMIT" VALUE="Add Group to Database"></CENTER></FORM></TD></TR></TABLE>';
echo '<BR />';
echo 'Here\'s the existing groups: <SELECT>';
$sqlgrouplist = "SELECT * FROM funkopops.popcollection ORDER BY popcollection ASC";
if (!$result = $con->query($sqlgrouplist)){
die ('There was an error running the query [' . $con->error . ']');
}
while ($row = $result->fetch_array()){
$groupname = $row['popcollection'];
echo '<OPTION VALUE="' . $groupname . '">' . $groupname . '</OPTION>';
}
echo '</SELECT><BR /><BR /> ';
}
}
include_once ('footer.php');
?>