Alright, I’m having some more problems with my subject of announcements scripts.
My database has three posts in it, one for each of the available subjects (not including all of course).
When I submit my choice it only shows two posts, thing is, they’re the same post, and the subject of it is under the “Site Updates” subject.
Thanks in advance of course.
[code=php]
<?php
include(‘header.php’);
$sql= “SELECT * FROM `post`”;
$results=mysql_query($sql);
$row=@mysql_fetch_array($results)
?>
<?php
if (!isset($_POST[‘subj’]))
{?>
<form method=”post”>
<dl align=”center”>~!~ Subject Of Announcement ~!~
<dd>Web Design<input type=”radio” name=”subj” value=”Web Design”></dd>
<dd>Tech Support<input type=”radio” name=”subj” value=”Tech Support”></dd>
<dd>Site Updates<input type=”radio” name=”subj” value=”Site Updates”></dd>
<dd>All<input type=”radio” name=”subj” value=”All”></dd>
</dl>
<input type=”submit” value=”View”>
</form>
<?php }
if (isset($_POST[‘subj’]))
{ $viewSub = $_POST[‘subj’];
if ($viewSub != “All”)
{
$query = “SELECT * FROM `post` WHERE `$viewSub` = ‘{$row[‘subject’]}'”;
$result2 = mysql_query($query);
while($row2 = mysql_fetch_array($result2)){ $posted = $row2[0]; }
}
else $posted = $row[‘post’];
}
//———————//
if (isset($viewSub))
{
if($username!=NULL){ ?><br><div align=”left”><b><a href=”addannouncement.php”>Add An Announcement</a></b></div><br><? }?>
<table border=”3″>
<tr>
<?php if($username!=NULL){ ?><td align=”center”><b>Options</b></td> <?php }?>
<td align=”center”><b>Date</b></td>
<td align=”center”><b>Anoucement</b></td>
<td align=”center”><b>Posted By</b></td>
</tr>
<?php while($row=mysql_fetch_array($results))
{?>
<tr>
<?php if($username!=NULL){ ?><td><?php include(‘adminedit.php’); ?></td> <?php }?>
<td><?php echo date(“d/m/y”, $row{‘date’}); ?></td>
<td valign=”top”><?php echo $posted ?></td>
<td align=”center” valign=”middle”><?php echo $row{‘username’}; ?></td>
</tr>
<?php
}
?>
</table>
<?php } ?>
<?php include(‘footer.php’); ?>