Hi All,
I have been learning making CMS and you guys have been helpful.
I can now post, and view the posts. I need to edit/delete articles.
I have read somewhere that you can make a link that appends an id of the article and you can retrieve it via $_GET. I cannot understand it and need help. Also another question, is that method safe? I read another place that GET method isn't secure!
Thanks!
Here is the code: view.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Articles</title>
<link type="text/css" rel="stylesheet" media="all" href="/site/site.css" />
</head>
<body>
<?php
require('/includes/inc.database.php');
?>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tr>
<td colspan="3" rowspan="1" id="header">
</td>
</tr>
<tr>
<td style = "width:230px;">
</td>
<td id="contents">
<?php
$db = new Connectdb();
$conn = $db->connect();
$article = $db->retrievedata($conn, 'articles');
//loop in the result
while ($row = mysql_fetch_object($article)) {
echo ("<center><h2>$row->heading</center></h2>");
echo("<br />");
echo("<p style='color:red;'><b style='color:black;'>Posted by </b> $row->creator <br /> $row->update_date </p>");
echo("<br />");
echo ($row->contents);
echo("<br />");
echo ("<p style='color:red;'><b style='color:black;'>Posted under: </b><em>$row->description</em> </p>");
//add link to edit or delete article
$pagetitle = "Testing the Change";
//make a break line and space for next article
echo '<br />';
echo '<hr style ="color:red;" />';
echo '<br />';
}
?>
</td>
<td style = "width:230px;">
</td>
</tr>
<tr>
<td colspan="3" rowspan="1" id="footer">
<?php include("/includes/inc.footer.php"); ?>
</td>
</tr>
</table>
<br>
</body>
</html>