Location: PHPKode > projects > EasyFest > new/view_topic123.php
<?php
include_once("include/db_connection.php");
	header("Expires: Thu, 17 May 2001 10:17:17 GMT");    // Date in the past
	header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
	header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
	header ("Pragma: no-cache");                          // HTTP/1.0              
	session_start();
		if($_SESSION["adminloggedIn"] == FALSE){
		header("Location:admin_login.php");
		exit;
	}

// get value of id that sent from address bar
$id=$_GET['s'];    
$UserName = $_SESSION['UserName'];

$tbl_name="forum_question";
$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);

$row=mysql_fetch_array($result);
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#F8F7F1"><strong><?php echo $row['topic']; ?></strong></td>
</tr>

<tr>
<td bgcolor="#F8F7F1"><?php echo $row['detail']; ?></td>
</tr>

<tr>
<td bgcolor="#F8F7F1"><strong>By :</strong><?php echo $row['name']; ?><strong>Email : </strong><?php echo $row['email'];?></td>
</tr>

<tr>
<td bgcolor="#F8F7F1"><strong>Date/time : </strong><?php echo $row['datetime']; ?></td></tr>
<tr>
<td bgcolor="#F8F7F1"><strong><a href="deleteTopic.php<?php echo "?id=$id";?>">delete</a></td>
</tr>
</table></td>
</tr>
</table>
<BR>
<?php
$tbl_name2="forum_answer"; // Switch to table "forum_answer"

$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";
$result2=mysql_query($sql2);
?>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="7%" align="center" bgcolor="#E6E6E6"><strong>ID</strong></td>
<td width="22%" align="center" bgcolor="#E6E6E6"><strong>Name</strong></td>
<td width="20%" align="center" bgcolor="#E6E6E6"><strong>Email</strong></td>
<td width="35%" align="center" bgcolor="#E6E6E6"><strong>Answer</strong></td>
<td width="16%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
</tr>
<?php
while($row=mysql_fetch_array($result2)){
?>

<tr>
<td bgcolor="#FFFFFF"><?php echo $row['a_id']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $UserName; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $row['a_email']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $row['a_answer']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $row['a_datetime']; ?></td>
</tr>




<?php 
}
?>


</table><?php 

?>
<BR>
<form name="form1" method="post" action="add_answer.php">
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>

<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">

<tr>
<td><strong>Email</strong></td>
<td>:</td>
<td><input name="a_email" type="text" id="a_email" size="45"></td>
</tr>
<tr>
<td valign="top"><strong>Answer</strong></td>
<td valign="top">:</td>
<td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="id" type="hidden" value="<?php echo $id; ?>" /></td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</td>
</form>
</tr>
Return current item: EasyFest