Stuck on this bit of code, and its bugging the hell out of me. This page is designed to update the name of the "enclosure", however when updating the name, it doesn't seem to recognize '$enclosureid' in the where clause.
Code: Select all
<html>
<?php
include 'global.php';
$enclosureid = $_GET['enclosureid'];
$enclosurename = $_GET['enclosurename'];
if (isset($_POST['rename']))
{
$newenclosurename = addslashes(strip_tags($_POST['enclosurenameedit']));
// UPDATE ENCLOSURE NAME
$updateenclosure="UPDATE enclosure SET enclosurename='$newenclosurename' where enclosureid='$enclosureid'";
mysql_query($updateenclosure) or die("Could not update enclosure name");
echo "<center><br>Rename successful.";
echo "<center><br><A href='javascript:history.go(-2)'>Go back";
}
else
{
$query = "SELECT * FROM enclosure WHERE enclosureid='$enclosureid'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
$enclosureid = $_row['enclosureid'];
?>
<div id='site_container'>
<form method="post" action="rename.php">
<table border='0' align='center'>
<tr>
<td height='200' colspan='2'></div></td>
</tr>
<tr>
<td colspan='2'><center>Rename<br><hr></center></td>
</tr>
<tr>
<td align='right' width='50%'>Current enclosure name</td><td width='50%'><input type='text' name='enclosurenameedit' size='20' value='<?php echo "".$row['enclosurename'].""; ?>'></td>
</tr>
<tr>
<td><input type="hidden" name="Language" value="English"></td>
</tr>
<tr>
<td colspan='2'><center><input type='submit' value='Rename' name='rename'><br /><br /><a href='javascript:history.go(-1)'>Back</a></center></td>
</tr>
</table>
</form>
</div>
<?php
}
?>
<?php include 'footer.php'; ?>
</html>