Location: PHPKode > projects > XMasDB > xmasdb/new.php
// start the session

// is the one accessing this page logged in or not?
if (!isset($_SESSION['basic_is_logged_in']) 
    || $_SESSION['basic_is_logged_in'] !== true) {

    // not logged in, move to login page
    header('Location: index.php');

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>X-Mas Gift Database</title>
<style type="text/css">@import url("style.css");</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<h2>X-Mas Gift Database</h2>

include 'config.php';
include 'lib/opendb.php';

$name = $_POST['name'];
$gift = $_POST['gift'];
$got = $_POST['got'];

$query = "INSERT INTO gifts (name, gift, got) VALUES ('$name', '$gift', '$got')";
mysql_query($query) or die('Error, insert query failed');

mysql_query($query) or die('Error, insert query failed');

include 'lib/closedb.php';

echo "<h3>New Gift Added Successfully!</h3><BR>
<p align='center'><input type=\"button\" class=\"btn\" onClick=\"window.location='list.php'\" value=\"Gift List\"> &nbsp; &nbsp;
<input type=\"button\" class=\"btn\" onClick=\"window.location='new.php'\" value=\"Add Another Gift\"></p>";

<form method="post" name="add" action="">
<p align="center">
<table width="400" border="0" cellspacing="0" cellpadding="3">
<td width="250">Name</td>
<td><input name="name" size="35" type="text" id="name"></td>
<td width="250">Gift</td>
<td><input name="gift" size="35" type="text" id="gift"></td>
<td width="200">Got It?</td>
<td><select name="got"><option value ="Yes">Yes</option><option value ="No">No</option></select></td>

<p align="center"><input type="button" class="btn" onClick="window.location='list.php'" value="Back"> &nbsp;&nbsp; <input class="btn" name="add" type="submit" id="add" value="Add New Gift"></p>



Return current item: XMasDB