I would like to create a page with a list of links to articles stored in the updates table in my MySQL database that each link to their own separate pages. I know that I can make one article page and link each article to display content dynamically. Example: Click an article title in a list, this link takes you to a page where the article information is shown. I know this can be done by using something like... <a href=\"$self?id=$id\">$tit
le</a></li
>\r\n" but I am still very fresh to php and MySQL.
Goals for this question:
1) Display a list of articles ordered by 'id'
2) Each article will have a link that redirects you to a page with the more information from the selected title.
THE CODE FOR THE ARTICLE LIST IS: (Saved as edithome.php)
<div id="edit">
<div id="editupdates"> </div>
<div id="editMiddle">
<div id="formleft">
<?php
$db = mysql_connect("p41mysql71.
secureserv
er.net", "DBFSM", "PASSWORD");
mysql_select_db ("DBFSM");
if (isset($_POST["save"])) {
$title=htmlspecialchars(tr
im($_POST[
"title"]))
;
$hook=htmlspecialchars(tri
m($_POST["
hook"]));
$content=htmlspecialchars(
trim($_POS
T["content
"]));
$tags=htmlspecialchars(tri
m($_POST["
tags"]));
if($title!="") {
$sql="INSERT INTO updates (`title`,`hook`,`content`,
`tags`) VALUES ('$title','$hook','$conten
t','$tags'
)";
$result=mysql_query($sql) ;
}
echo "<b>Article '$title' added!</b>";
}
?>
</div>
<div id="form" > <br>
<form method="post">
<table width="100%" border="0">
<tr>
<td>TITLE:</td>
<td><input name="title" type="text" value="Simple title only." size="45"></td>
</tr>
<tr>
<td>HOOK:</td>
<td><input name="hook" type="text" value="Keep this text short." size="60"></td>
</tr>
<tr>
<td>CONTENT:</td>
<td> <textarea name="content" cols="65" rows="13">Tips To Writing A Great Article!-
1. DELETE THIS POST BEFORE POSTING THIS ARTICLE.
2. Make your opinion known.
3. Link like crazy.
4. Write less.
5. 250 Words is enough.
6. Make Headlines snappy.
7. Write with passion.
8. Include Bullet point lists.
9. Edit your post.
10. Make your posts easy to scan.
11. Be consistent with your style.
12. Litter the post with keywords.</textarea></td>
</tr>
<tr>
<td>TAGS</td>
<td><input name="tags" type="text" value="Separate by commas!" size="60"></td>
</tr>
<tr>
<td> </td>
<td><input name="save" type="submit" value="Post Article"></td>
</tr>
</table>
</form>
</div>
</div>
<div id="editBottom"> </div>
<div id="articlelist">
<div id="displayupdates">
</div>
<div id="editMiddle">
LIST OF LINKED ARTICLES GOES HERE
</div>
<div id="editBottom"> </div>
</div>
THE CODE FOR THE RETURNED ARTICLE GOES HERE: (saved as article.php)
<div id="edit">
<div id="editupdates"> </div>
<div id="editMiddle">
RETURNED DATABASE ARTICLE GOES HERE
</div>
<div id="editBottom"> </div>
<div id="articlelist">
<div id="displayupdates">
</div>
<div id="editMiddle">
</div>
<div id="editBottom"> </div>
</div>
</div>
<div id="footer">
<div id="footerImage"></div>
</div>
</div>
</body>
</html>
THANKS VERY MUCH