Hello everyone:
I have wrote a simple guestbook and display its contents (Name,Subject,Date) without problem.
guestbook table ID,Name,Subject,Email,TimeStamp,Message
but when I use select list to display records with three options "by Author,By Subject,By Date) it fails.There's my code:
function view() { ?>
<form action="view.php3" method=post>
<select name="view">
option value="Name">View by Author
<option value="Subject">View by Subject
<option value="TimeStamp">View by Date
</select>
<input type="Submit" name="submit" value="go">
<input type="hidden" name="action" value="viewtype">
</form>
<center><table border=0 cellpadding=4 cellspacing=1>
<tr><th bgcolor="#6699ff">Author</th><th bgcolor="#6699ff">Subject</th><th bgcolor="#6699ff">Postal Date</th></tr>
<? $query_subject=mysql_query("select * from guestbook order by $view");
while($post=mysql_fetch_array($query_subject) ) { ?>
<tr>
<td bgcolor="#66ccff"><? echo $post['Name'] ?></td>
<td bgcolor="#66ccff">
<a href="message.php3?ID=<?echo $post['ID'] ?>"><? echo $post['Subject']?></a>
</td>
<td bgcolor="#66ccff"><?echo strftime("%Y/%m/%d %H:%M",$post['TimeStamp'])?></td>
</tr>
<? } ?>
</table></center>
<? }
Any body help me to solve this problem?Thx