} else {
$query = "SELECT title, author, post, id FROM news_posts WHERE id=$id";
$result = mysql_query($query);
$num = mysql_num_rows($result);
$row = mysql_fetch_array ($result, MYSQL_NUM);
$title = $row['0'];
$name = $row['1'];
$message = $row['2'];
if ($num == 1) {
echo '
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<p><b>Post Title :</b><br />
<input type="text" class="form-control" name="title" value="'.$title.'" /></p>
<p><input type="hidden" name="name" size="15" maxlength="255" value="'.$name.'" /></p>
<p><b>Post Message :</b><br /><textarea rows="7" class="form-control" name="message">'.$message.'</textarea></p>
<p><input type="button" value="Back" onclick="history.back()"> <input type="submit" name="submit" value="Submit" /></p>
<input type="hidden" name="submitted" value="TRUE" /></p>
<input type="hidden" name="id" value="'.$id.'" /></form>';
} else {
echo 'News post could not be edited, please try again.';
}
}
?>
答案 0 :(得分:0)
这是因为PHP_SELF周围的单引号正在中断echo中的单引号。试试这个:
<form action="' . $_SERVER['PHP_SELF'] . '" method="post">