Ok here is the code and i can not get the updateform part to update...
<?
require_once "../conf/common.php";
memberchecklogin();
dbconnect();
if($action=="logout"){
memberchecklogout();
}
if(isset($_POST['submitdelete'])){
$query="DELETE FROM banners
WHERE memberid = '$membername' AND id = '$id'";
mysql_query($query) or die( "ERROR: " . mysql_error() . "\n");
$res="Successfully deleted an record";
}
if(isset($_POST['submitupdate'])){
$error="";
$bannerid = $_POST['id'];
$url = $_POST['url'];
$weight = $_POST['weighting'];
$category = $_POST['categoryg'];
$sizeid = $_POST['sized'];
if (!$url)
{
$error .= "- You must select a url for the banner.<br>\n";
}
if (!$category)
{
$error .= "- You must select a category for the banner.<br>\n";
}
if (!$sizeid)
{
$error .= "- You must select the dimensions for this banner.<br>\n";
}
if ($weight > 0 && $weight < 6)
{
$error .= "- You must select a weighting for the banner.<br>\n";
}
$act=getSetting("approvedupdate");
if($act=="Y")
{
$query="UPDATE banners
SET url = '$url',
categoryid = $category,
weighting = $weight,
sizeid = $sizeid
WHERE memberid = '$membername' AND id = '$bannerid'";
}
else
{
$query="UPDATE banners
SET url = '$url',
categoryid = $category,
weighting = $weight,
sizeid = $sizeid,
approved = 'N'
WHERE memberid = '$membername' AND id = '$bannerid'";
}
}
?>
<?PHP
//Query to show banners
$query = "SELECT banners.id, banners.memberid, banners.name, banners.categoryid, banners.url,
banners.weighting, banners.filetype, banners.approved, banners.sizeid,
sizes.width, sizes.height
FROM banners INNER JOIN sizes ON banners.sizeid = sizes.id
WHERE banners.memberid = '$membername'
ORDER BY banners.name";
//$bannerfound = 0;
$result = mysql_query($query) or die( "ERROR: " . mysql_error() . "\n");
while ($myrow = mysql_fetch_array($result)){
$id=$myrow["id"];
$name=$myrow["name"];
$categoryid=$myrow["categoryid"];
$url=$myrow["url"];
$weighting=$myrow["weighting"];
$filetype=$myrow["filetype"];
$approved=$myrow["approved"];
$sizeid=$myrow["sizeid"];
$width=$myrow["width"];
$height=$myrow["height"];
//Sort out weightings.
/*
for ($count=1; $count<=5; $count++) {
if ($count == $_POST['weighting']) {
$ws[$count - 1] = " selected";
} else {
$ws[$count - 1] = "";
}
}
*/
for ($count=1; $count<=5; $count++) {
if ($count == $weighting) {
$ws[$count - 1] = " selected";
} else {
$ws[$count - 1] = "";
}
}
//Check to see if banner was approved
if($approved =="Y")
{
$active="Approved";
}
else
{
$active="Awaiting Approval";
}
?>
<form method="post" action="banners_manage.php">
<table border="0" width="550" cellspacing="0" cellpadding="3" bgcolor="<?=getSetting("areafillcolor")?>" align="center">
<tr>
<td width="30">
<input type="hidden" name="id" value="$id">
</td>
<td width="490">
<div align="center"><b><? echo$name;?></b> (<? echo$active;?>)</div>
</td>
<td width="30"> </td>
</tr>
<tr>
<td width="30"> </td>
<td width="490">
<!-- this should show the banner and it isn't showing the dang thing -->
<div align=\"center\"><img src=\"<?=getSetting("siteurl")?>/banners/<? echo$id;?><? echo$filetype;?>\" width=\"<? echo$width;?>\" height=\"<? echo$height;?>\"></div>
</td>
<td width="30"> </td>
</tr>
<tr>
<td width="30" height="89"> </td>
<td width="490" height="89">
<table border="0" width="100%">
<tr>
<td width="39%"><font size="2">URL To Go To:</font></td>
<td width="61%"><font size="2">
<input type="text" name="url" size="30" maxlength="255" value=<? echo$url;?>>
</font></td>
</tr>
<tr>
<td width="39%"><font size="2">Category:</font></td>
<td width="61%">
<?
$sql="SELECT id, name FROM categories ORDER by id ASC";
$result2=mysql_query($sql);
$options="";
while ($row2=mysql_fetch_array($result2)) {
$cat_id=$row2["id"];
$cat_name=$row2["name"];
$selected = ($cat_id == $categoryid) ? " selected" : "";
$options.="<option value=\"$cat_id\"$selected>".$cat_name."</option>\n";
}
?>
<SELECT NAME=categoryg>
<OPTION VALUE=0>Choose
<?=$options?>
</SELECT>
</td>
</tr>
<tr>
<td width='39%'><font size='2'>Dimensions:</font></td>
<td width='61%'>
<?
$sql="SELECT id, width, height FROM sizes ORDER by id ASC";
$result3=mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result3)) {
$pc_id=$row["id"];
$pc_width=$row["width"];
$pc_height=$row["height"];
$bothwh = "$pc_width x $pc_height";
$selected = ($pc_id == $sizeid) ? " selected" : "";
$options.="<OPTION VALUE=\"$pc_id\"$selected>".$bothwh."</option>\n";
}
?>
<SELECT NAME=sized>
<OPTION VALUE=0>
<?=$options?>
</SELECT>
</td>
</tr>
<tr>
<td width="39%"><font size="2">Weighting:</font></td>
<td width="61%">
<select name="weighting">
<option value="1"<?=$ws["0"]?>>1 (Least Shows)</option>
<option value="2"<?=$ws["1"]?>>2</option>
<option value="3"<?=$ws["2"]?>>3</option>
<option value="4"<?=$ws["3"]?>>4</option>
<option value="5"<?=$ws["4"]?>>5 (Most Shows)</option>
</select>
</td>
</tr>
<tr>
<td width="39%"></td>
<td width="61%"><font size="2">
<input type="hidden" name="id" size="30" maxlength="255" value=<? echo$id;?>>
</font></td>
</tr>
<tr>
<td width="100%" colspan="2">
<div align="center">
<input type="submit" name="submitupdate" value="Update Banner">
</div>
</td>
</tr>
</table>
</td>
<td width="30" height="89"> </td>
</tr>
<tr>
<td width="30"> </td>
<td width="490">
<div align="center">
<input type="submit" name="submitdelete" value="Delete Banner">
</div>
</td>
<td width="30"> </td>
</tr>
</table>
</form>
<?
};
?>