I have some code which is giving me the following parse error:
Parse error: parse error in /chroot/home/TM340484/public_html/blog/completelist.php on line 80
line 80 is the last line of my code. Looking through the forum I found advice about the <?php tag, so have changed the tags to <?php. This hasn't made a difference though.
Perhaps someone could look at my code and give me an idea of what is wrong. I have been looking at it for ages now, and I can't see where the error is. I can't carry on with what I'm doing until I get this bit right!
Here is my code in its entirity.
<body>
<?php
$article_id = $_GET['article_id'];
include("myconnect.php");
$result = mysql_query("SELECT * FROM article WHERE article_id='$article_id'");
mysql_close();
?>
<h3>Edit Current/Archived Articles</h3>
<?php
while ($myrow = mysql_fetch_array($result))
{
?>
<form method="POST" action="completelist.php">
<input type="number" name="article_id" value= "<?php echo $myrow["article_id"]; ?>" >
<p><b>Title</b><br>
<input type="text" name="article_title" size="60" maxlength="60" value="<?php echo $myrow["article_title"]; ?>">
<p><b>Current Status</b><br>
Current <input type="radio" name="status" value="C" <?php if ($myrow["status"]=="C") { echo "checked"; } ?>>
Archived <input type="radio" name="status" value="A" <?php if ($myrow["status"]=="A") { echo "checked"; }?>>
<br><b>Article Text</b> <br>
<textarea name="article_text" cols="45" rows="12" wrap="on"><?php echo $myrow["article_text"]; ?></textarea>
<br><b>Associated Image</b> <br>
<input type="text" name="article_imagelink" size="60" maxlength="60" value="<?php echo $myrow["article_imagelink"]; ?>">
<?php
}// end while
?>
<input type="submit" value="Save" name="submit" ><br>
</form>
<?php
if ($HTTP_POST_VARS['save'])
{
include("myconnect.php");
$article_id=$HTTP_POST_VARS['article_id'];
$status=$HTTP_POST_VARS['status'];
$article_title=$HTTP_POST_VARS['article_title'];
$article_text=$HTTP_POST_VARS['article_text'];
$article_imagelink=$HTTP_POST_VARS['article_imagelink'];
$article_date=$HTTP_POST_VARS['article_date'];
$article_top_id=$HTTP_POST_VARS['article_top_id'];
echo "<p><p>You entered the following information:<br>";
echo "<b>article_id:</b> $article_id<br>";
echo "<b>status:</b> $status<br>";
echo "<b>article_text:</b> $article_text<br>";
echo "<b>article_imagelink:</b> $article_imagelink<br>";
echo "<b>article_date:</b> $article_date<br>";
echo "<b>article_top_id:</b> $article_top_id<br>";
$updatearticlequery =("UPDATE article SET status='$status', article_title='$article-title', article_text='$article-text', article_imagelink='$article_imagelink', article_date='$article-date,'article_top_id='$article_top_id' WHERE article_id='$article_id'");
$result=mysql_query($updatearticlequery);
if ($result) {
header ('Location: next.php?confirm= Item successfully updated');
}//end if result
else {
echo "<b>ERROR: unable to post - Try again</b>";
}//end else
?>
</body>
This is driving me crazy... I have deconstructed the page and tried to do it in sections. The first part - the form - display Ok, only when I added the second part - the updating the records bit - has this problem appeared.
Any help would be greatly appreciated.
Harlequeen