'; if ($insfunko == 1){ $popno = mysqli_real_escape_string($con, $_POST['popno']); $popname = mysqli_real_escape_string($con, $_POST['popname']); $popdate = mysqli_real_escape_string($con, $_POST['todaysdate']); $popcollectionid = mysqli_real_escape_string($con, $_POST['popcollectionid']); list ($y, $m, $d) = explode('-', $popdate); if (!checkdate($m, $d, $y)) { echo 'Date is invalid ' . $popdate . '
'; echo 'Date format is YYYY-MM-DD / 1977-06-07
'; echo 'Please click HERE to try again'; echo '

Return to home.'; include_once ('footer.php'); exit(); } $sqlfunkins = "INSERT INTO funkopops.pops (userid, popno, popname, popcollectionid, inserteddate) VALUES ($userid, $popno, '$popname', $popcollectionid, '$popdate')"; if (!$funkoinsert = $con->query($sqlfunkins)){ die ('There was an error running the query [' . $con->error . ']'); } echo 'You have successfully entered ' . $popname . ' into the database!
'; echo 'Refreshing page in 2 seconds to add another pop to your collection!
'; header("refresh:2;url=newfunko.php"); } else { echo ''; echo ''; echo ''; $sqlpopcollection = "SELECT * FROM popcollection ORDER BY popcollection ASC"; if (!$results = $con->query($sqlpopcollection)){ die ('There was an error running the query [' . $con->error . ']'); } echo ''; echo ''; echo '
Pop Number:
Pop Name:
Pop Collection:
Date Purchased:
'; } } else { echo 'Please login HERE before continuing.'; } include_once ('footer.php'); ?>