Hi everyone
I have been getting an error:
parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in root\editannounce.php on line 15
In the code below the line causing the problem is the line
if (isset($_POST['confirmbtn']))
Can anyone see why this error is occuring?
<?php
include ($_SERVER['DOCUMENT_ROOT']. '/includes/functions.php');
require ($_SERVER['DOCUMENT_ROOT']. '/includes/header.php');
$idquery = "SELECT * FROM announce WHERE annoid = '" . $_POST['annoid'] ."'; //need to have the id posted from edit button in viewannounce
$result= mysql_query($idquery) or print(mysql_error());
$olddata = (mysql_fetch_assoc($result));
$oldsubject = '$olddata[subject]';
$oldbody = '$olddata[body]';
$annoid = '$_POST[annoid]'; //if below doesnt work as its the second post of annoid use this variable
if (isset($_POST['confirmbtn'])) { // this btn is at the bottom of the page
if (is_adminauthed())
{
$subquery = "UPDATE announce SET subject = '" . $_POST['subject'] ."' WHERE annoid = $_POST['annoid']";
$res = mysql_query($subquery) or print(mysql_error()."<br />");
$bodyquery = "UPDATE announce SET body = '" . $_POST['body'] ."' WHERE annoid = $POST['annoid']";
$res = mysql_query($bodyquery) or print(mysql_error()."<br />");
}
if (is_authed()) //below copies annoucement into announceedit as is and takes the old annoid as oldannoid so when update is confirmed the original record can be updated in the table
{
$editquery = "INSERT INTO announceedit(memid, postdate, subject, body, filepath, docid, oldannoid)
SELECT memid, postdate, subject, body, filepath, docid, annoid
FROM announce WHERE annoid = '$annoid'";
$result = mysql_query($editquery)
$insertid = mysql_insert_id();
//the below 2 lines update the copy of the original record with the new subject and body
$updatequery = "update annouceedit SET subject = '" . $_POST['subject'] ."' WHERE annoid = $insertid;
$updatequery2 = "update annouceedit SET body = '" . $_POST['body'] ."' WHERE annoid = $insertid;
}
}
mysql_close();
?>
<tr>
<td width="795" colspan="4" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<form method="post" action="editannounce.php">
<h2>Update Announcement:</h2>
<br>
<p> Below is the current content, edit it as required and click the confirm button </p>
<input type = "text" size ="45" name ="subject" value= "<?php print $oldsubject; ?>" >
<br>
<br>
<textarea name="body" cols="60" rows="10"><?php print $oldbody; ?></textarea>
<br>
<br>
<p>
<input type= "submit" name="confirmbtn" value= "Confirm">
<br><br>
<?php if ($res) {echo ("Your Announcement has been updated" );} ?>
</p>
</form>
</tr>
<?PHP require ($_SERVER['DOCUMENT_ROOT']. '/includes/footer.php');
}
?>
Thanks in advance for any help