Hi, thanks for the response! Here is all of my code. I looked and don't see where there could be any sort of a conflict. I am just trying to remove the little snippet of code at the top that contains my db username and login info. I removed the form input fields to save space.
Thanks!
<?php
require 'DB.php';
require '../formhelpers.php';
$db = DB::connect('');
if (DB::isError($db)) { die ("Can't connect: " . $db->getMessage()); }
$db->setErrorHandling(PEAR_ERROR_DIE);
$db->setFetchMode(DB_FETCHMODE_ASSOC);
if ($_POST['_submit_check']) {
process_form();
}
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<style fprolloverstyle>A:hover {color: #006699; text-decoration: blink; font-weight: bold}
</style>
</head>
<body topmargin="0" leftmargin="0" link="#666666" vlink="#666666" alink="#666666">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1" height="68" bgcolor="#DDDDDD">
<tr>
<td width="355" height="41" background="Images/HeaderBack.gif">
<img border="0" src="Images/HeaderLeft.gif" width="295" height="41"></td>
<td height="41" background="Images/HeaderBack.gif"> </td>
<td width="462" background="Images/HeaderRight.gif" height="41">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table2">
<tr>
<td>
<p align="right"><font face="Arial" size="2" color="#FFFFFF"><SCRIPT Language="JavaScript">
<!-- hide from old browsers
function GetDay(intDay){
var DayArray = new Array("Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday")
return DayArray[intDay]
}
function GetMonth(intMonth){
var MonthArray = new Array("January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December")
return MonthArray[intMonth]
}
function getDateStrWithDOW(){
var today = new Date()
var year = today.getYear()
if(year<1000) year+=1900
var todayStr = GetDay(today.getDay()) + ", "
todayStr += GetMonth(today.getMonth()) + " " + today.getDate()
todayStr += ", " + year
return todayStr
}
//-->
</SCRIPT>
<SCRIPT Language="JavaScript">
<!-- hide from old browsers
document.write('<font size="1" face="Arial"><B>' + getDateStrWithDOW())
//-->
</SCRIPT></td>
<td width="30"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
<td>
<p align="center"><b><font size="2" face="Arial" color="#666666">
<a href="WMR_Admin_Dance.htm" style="text-decoration: none">WMR Dance</a>
| </font><font size="2" face="Arial" color="#DB801A">WMR
Lounge</font></b></td>
<td>
</td>
</tr>
<tr><td colspan="3"><div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif"><a href="WMR_Admin_Lounge_Headlines.php">Headlines</a>
| <a href="WMR_Admin_Lounge.php">Add/Update/Delete
Products</a> | <a href="WMR_Admin_Lounge_Links_Category.php">Add Link
Categories</a> | <a href="WMR_Admin_Lounge_Delete_Links_Categories.php">Delete
Link Categories</a> | <a href="WMR_Admin_Lounge_Links.php">Add
Link</a> | <a href="WMR_Admin_Lounge_Edit_Delete_Links.php">Update/Delete Links</a></font></strong></div></td></tr>
</table>
<p> <img border="0" src="Images/WM_lounge.jpg" width="178" height="48"></p>
<div align="center">
<table border="1" width="80%" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#DDDDDD" id="table3">
<tr>
<td> <div align="center">
<table border="0" width="94%" cellspacing="0" cellpadding="0" id="table4">
<tr>
<td width="63%" background="Images/HeaderBack3.gif" height="34">
<font face="Arial" size="2" color="#FFFFFF">
<b>Add Lounge Headline</b></font></td>
<td width="6%"> </td>
<td background="Images/HeaderBack3.gif" height="34" width="30%">
<font face="Arial" size="2" color="#FFFFFF">
</font><b><font face="Arial" size="2" color="#FFFFFF">
Edit Lounge Headlines</font></b></td>
</tr>
<tr>
<td width="63%" bgcolor="#F0F0F0" valign="top">
<table width="424">
<form method="POST" enctype="multipart/form-data" action="">
<tr><td>UPC: </td><td><input type="text" name="upc" size="10" maxleng="10"></td></tr>
<tr><td>Category</td><td>
<?php
print "<select name=\"category\">";
print "<option value=\"0\" selected></option>";
$rows = $db->getAll('SELECT category FROM lounge_categories');
foreach ($rows as $row) {
$category = $row[category];
print "<option value=\"$row[category]\">$category</option>";
}
print "</select>";
?>
</td></tr>
<tr><td>Also Available (Top):</td><td>
<?php
print "<select name=\"top\">";
print "<option value=\"0\" selected></option>";
$rows = $db->getAll('SELECT upc, artist_name, album_title, also_avail_top, also_avail_mid, also_avail_bot FROM lounge_products');
foreach ($rows as $row) {
$artist_name = stripslashes($row[artist_name]);
$album_title = stripslashes($row[album_title]);
print "<option value=\"$row[upc]\">$artist_name - $album_title</option>";
}
print "</select>";
?>
</td></tr>
<tr><td>Also Available (Middle):</td><td>
<?php
print "<select name=\"middle\">";
print "<option value=\"0\" selected></option>";
$rows = $db->getAll('SELECT upc, artist_name, album_title, date_format(release_date, \'%M %d, %Y\') as release_date, date_format(add_date, \'%M %d, %Y\') as add_date, description, price, image FROM lounge_products');
foreach ($rows as $row) {
$artist_name = stripslashes($row[artist_name]);
$album_title = stripslashes($row[album_title]);
print "<option value=\"$row[upc]\">$artist_name - $album_title</option>";
}
print "</select>";
?>
</td></tr>
</td></tr>
<tr><td>Also Available (Bottom):</td><td>
<?php
print "<select name=\"bottom\">";
print "<option value=\"0\" selected></option>";
$rows = $db->getAll('SELECT upc, artist_name, album_title FROM lounge_products');
foreach ($rows as $row) {
$artist_name = stripslashes($row[artist_name]);
$album_title = stripslashes($row[album_title]);
print "<option value=\"$row[upc]\">$artist_name - $album_title</option>";
}
print "</select>";
?>
<tr><td colspan="2" align="center"><?php input_submit('save','Add'); ?>
</td></tr>
</table>
<input type="hidden" name="_submit_check" value="1"/>
</form>
<p> </td>
<td width="6%"> </td>
<td bgcolor="#F0F0F0" valign="top"> <div align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="0" id="table6">
<?php
print "<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#000000\" width=\"300\">";
$rows = $db->getAll('SELECT upc, artist_name, album_title, image FROM lounge_products ORDER BY artist_name ASC, upc ASC');
foreach ($rows as $row) {
$artist_name = stripslashes($row[artist_name]);
$album_title = stripslashes($row[album_title]);
print "<tr><td rowspan=\"3\"><img src=\"../$row[image]\" width=\"60\" height=\"60\"></td>
<td colspan=\"2\">UPC: $row[upc]</td></tr>
<tr><td colspan=\"2\">Artist: $artist_name</td></tr>
<tr><td colspan=\"2\">Album: $album_title</td></tr>
<tr><tr><td></td><td><a href=\"WMR_Admin_Lounge_Delete.php?upc=$row[upc]&artist_name=$row[artist_name]&album_title=$row[album_title]\">Delete</a>
<a href=\"WMR_Admin_Lounge_Update.php?upc=$row[upc]&artist_name=$row[artist_name]&album_title=$row[album_title]\">Update</a></td></tr>
<tr><td colspan=\"2\"> </td></tr>";
}
?>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<p> </div>
</td>
</tr>
</table>
</div>
</body>
</html>
<?php
function process_form() {
$filetypes = array ('image/gif', 'image/jpg', 'image/jpeg');
if (in_array($_FILES['upfile']['type'], $filetypes)){
$currentname = $_FILES['upfile']['name'];
$newname = $currentname.date("Ymdhis");
$uploaddir = "../uploads/";
if (move_uploaded_file($_FILES['upfile']['tmp_name'], $uploaddir.'/'.$newname)) {
print("file upload was successful");
} else {
print("file upload failed");
}
} else {
print "Please use a .gif or .jpg file";
}
// Access the global variable $db inside this function
global $db;
$upc = $_POST['upc'];
$category = $_POST['category'];
$artist_name = addslashes($_POST['artist_name']);
$album_title = addslashes($_POST['album_title']);
$release_date = $_POST['release_date'];
$description = nl2br(addslashes($_POST['description']));
$track_list = nl2br(addslashes($_POST['track_list']));
$price = $_POST['price'];
$imagename = $uploaddir.$newname;
$top = $_POST['top'];
$mid = $_POST['middle'];
$bot = $_POST['bottom'];
$db->query('INSERT INTO lounge_products (upc, category, artist_name, album_title, release_date, description, track_list, price, image, also_avail_top, also_avail_mid, also_avail_bot)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)',
array(htmlentities($_POST['upc']), $_POST['category'], htmlentities($_POST['artist_name']), htmlentities($_POST['album_title']), htmlentities($_POST['release_date']), nl2br(htmlentities($_POST['description'])), nl2br(htmlentities($_POST['track_list'])), htmlentities($_POST['price']), $imagename, $top, $mid, $bot));
print "<script>window.location='WMR_Admin_Lounge.php'</script>";
}
?>