/
Foruma.php
executable file
·129 lines (111 loc) · 3.49 KB
/
Foruma.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<style>
.questionblock{
border-color:#C7DA8B;
margin-left:4px;
margin-right:4px;
margin-top:4px;
margin-bottom:4px;
border-style: solid;
border-width:thin;
padding = 4px 4px 4px 4px;
background-color = "#C7DA8B";
font-family:Verdana;
}
.answerblock{
border-color:#F5BF9C;
margin-left:4px;
margin-right:4px;
margin-top:4px;
margin-bottom:4px;
border-style: solid;
border-width:thin;
padding = 4px 4px 4px 4px;
background-color = "#F5BF9C";
font-family:Verdana;
}
.userblock{
border-color:#AAAAFF;
margin-left:4px;
margin-right:4px;
margin-top:4px;
margin-bottom:4px;
border-style: solid;
border-width:thin;
padding = 4px 4px 4px 4px;
background-color = "#AAAAFF";
font-family:Verdana;
}
.headerItem{
font-family:Verdana;
font-size:24px;
color:#333366;
}
.headerClass{
font-family:Verdana;
font-size:21px;
color:#333366;
}
.text{
font-family:Verdana;
font-size:13px;
color:#333366;
}
</style>
<?php
/*
* Created on 25-Jan-09
* Foruma stands for Forum- Answers
*
*/
include 'Services/ForumServices.php';
$qId = $_REQUEST['qid'];
$action = $_REQUEST['action'];
if($action == "postAnswer"){
$answerText = $_REQUEST["answerText"];
postAnswer($qId,$answerText);
}
$qDetails = getQuestionBasicDetails($qId);
echo "<table><tr><td><img src='images/Disscussion.png'/></td><td><font class='headerItem'>".$qDetails['itemName']." discussion page</font></td></tr></table>";
echo "<font class='headerClass'>".$qDetails['className']."</font>";
//echo "<h1><img src='images/Disscussion.png'/>".$qDetails['itemName']."</h1>";
//echo "<h2>".$qDetails['className']."</h2>";
echo "<table width='100%'><tr><td class='userblock' width='100px'>";
echo "<center><img src='imgs/users/Dummy_user_small.png'/><br><center><a class='text' href='#'>".$qDetails['qPostedBy']."</a></center>";
echo "</td><td class='questionblock'>";
echo "<b class='text'>".$qDetails['qText']."</b>";
echo "<br><p class='text'> Asked on ".$qDetails['qPostedOn']." </p>";
echo "</td></tr></table>";
echo "<BR>";
$allAns = getAnswers($qId);
while ($row = mysql_fetch_assoc($allAns)){
$ansId = $row['ans_id'];
$ansQesId = $row['qus_id']; // Mostly woul't hav any significance'
$ansDesc = $row['ans_desc'];
$ansPostedBy = $row['ans_posted_by'];
$ansPostedOn = $row['ans_posted_on'];
echo "<table width='100%'><tr><td class='userblock' width='100px'>";
echo "<center><img src='imgs/users/Dummy_user_small.png'/><br><center><a class='text' href='#'>".$ansPostedBy."</a></center>";
echo "</td><td class='answerblock'>";
echo "<b class='text'>".$ansDesc."</b>";
echo "<br><p class='text'> Posted on ".$ansPostedOn." </p>";
echo "</td></tr></table>";
//echo "<h3>".$ansDesc."</h3>";
//echo "<p>Posted By: ".$ansPostedBy." on ".$ansPostedOn."</p>";
}
?>
<script language="javascript">
function postAnswer(){
var form = document.getElementById("answerForm");
form.action = "Foruma.php?action=postAnswer";
form.submit();
}
</script>
<form id="answerForm" method="post">
<input type="hidden" id="qid" name="qid" value="<? echo $qId?>"/>
Write down your reply here:
<table><tr><td>
<textarea id="answerText" name="answerText" cols=70 rows=5></textarea>
</td><td>
<img src="images/post_button.gif" style="cursor:hand;" onclick="postAnswer()"/></td>
</tr></table>
</form>