Newsgroup: it.comp.www.php
Titolo: problema pagina faq

Ciao, ho una pagina in cui sono visualizzate delle faq;
quando clicca su una domanda delle faq viene visualizzata la risposta(con 
javascript).
Per� cliccando su una qualsiasi domanda viene visualizzata sempre la prima 
risposta
della prima domanda delle faq.
Potete aiutarmi?
Questo � il link:
http://www.misterjolly.com/faq/faq.php?category_id=6&cat_name=ASSISTENZA
Questo � il codice della pagina:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head>
 <td valign="top" width="50%" bgcolor="#FFFFFF"><img border="0" 
src="misterjolly-small.GIF" align="absmiddle" width="65" height="58">
            <font size="6" face="Verdana" color="#FF0000">Le FAQ di 
Misterjolly</font></td>
<?php
$print = isset($_GET['print']) ? $_GET['print'] : false;
$category_id = isset($_POST['category_id']) ? $_POST['category_id'] : 
$_GET['category_id'];
$cat_name = isset($_POST['cat_name']) ? $_POST['cat_name'] : 
$_GET['cat_name'];
$answer = isset($_POST['answer']) ? $_POST['answer'] : 0;
include "faq_config.php";
?>
<title><?php echo "$cat_name"; ?></title>
<META HTTP-EQUIV="expires" CONTENT="0"><META HTTP-EQUIV="Pragma" 
CONTENT="no-cache">
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
a {
 text-decoration: none
 }
 </style>
<script language="JavaScript">
function submit_faq(){
var obj = document.getElementById("quest");
obj.submit();
}
var howManySeconds = 1
function pause() {
myTimer=setTimeout("whatToDo()",howManySeconds*1000)
}
function whatToDo() {
window.print()
}
</script>
</head>
<body <?php if ($print) { print "onload=\"pause()\""; } ?>>
<table width="100%" height="100%" border="0" cellpadding="0" 
cellspacing="0">   <tr> <td class="poptop" height="15"><img 
src="images/spacer.gif" width="3" height="3"></td>   </tr>   <tr> <td 
class="hrz_line"><img src="images/spacer.gif" width="1" height="1"></td> 
</tr>   <tr> <td style="background: #ffffff; padding: 5px" 
valign="middle"><h1 style="margin-top: 0; margin-bottom: 0"><?php echo 
"$cat_name" ?></h1></td>   </tr>   <tr> <td class="hrz_line"><img 
src="images/spacer.gif" width="1" height="1"></td>   </tr>   <tr> <td 
valign="top" style="padding: 1em" class="maincontent" height="400">
<p><?php echo $faq_instruct; ?></p> <p><a href="<?php echo 
"$PHP_SELF?print=true&cat_name=$cat_name&category_id=$category_id" ?>"><?php 
echo "$s_print_faq" ?></a></p>
<table width="100%" border="0" cellpadding="8" cellspacing="0">
<?php
$result = mysql_query("SELECT * FROM faqs WHERE category_id = 
'$category_id'") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
if (($answer == "$row[id]") || ($print == "true")) {
print "<tr>                    <td class=\"QA\" valign=\"top\">Q </td>";
print "<form name=\"quest\" id=\"quest\" action=\"$PHP_SELF\" 
method=\"post\">\n";
print "<input type=\"hidden\" name=\"category_id\" 
value=\"$category_id\"></p>\n";
print "<input type=\"hidden\" name=\"cat_name\" value=\"$cat_name\">\n";
print "<input type=\"hidden\" name=\"answer\" value=\"0\">\n";
print "</form>\n<td><pre class=\"question\"><a 
href=\"javascript:submit_faq();\">$row[question]</a></pre>";
print "</td></tr>\n";
print "<tr> <td class=\"QA\" valign=\"top\">A</td>  <td><pre 
class=\"answer\">$row[answer]</pre>  <br>
<a 
href=\"$PHP_SELF?answer=0&cat_name=$cat_name&category_id=$category_id#$answer\">" 
. $s_close . "</a><br></td>   </tr>\n";
}
else {
print "<tr>  <td class=\"QA\" valign=\"top\">Q <a name=\"$row[id]\"></td> 
<td>";
print "<form name=\"quest\" id=\"quest\" action=\"$PHP_SELF\" 
method=\"post\">\n";
print "<input type=\"hidden\" name=\"category_id\" 
value=\"$category_id\"></p>\n";
print "<input type=\"hidden\" name=\"cat_name\" value=\"$cat_name\">\n";
print "<input type=\"hidden\" name=\"answer\" value=\"$row[id]\">\n";
print "</form>\n<pre class=\"question\"><a 
href=\"javascript:submit_faq();\">$row[question]</a></pre></td> 
</tr>\n";
}                                                       }
?>
  </table> </td>   </tr>   <tr> <td class="hrz_line">
  <img src="images/spacer.gif" width="1" height="1"></td>   </tr>   <tr> <td 
height="20" class="popbot">
  <a href="javascript:window.close()"><?php echo "$s_close"; ?></a></td>
  </tr></table></body></html> 

 
http://www.misterjolly.com/faq/faq.php?category_id=6&cat_name=ASSISTENZA
questo è il gruppo giusto: it.comp.lang.javascript
hint: in una pagina non devono mai esserci due elementi con lo stesso id.