按链接显示/隐藏<div>

I want to show a element when I click a link. All links are questions and all the contains answers for each question . Both question and answer are taken from database so I want to have their id.

The problem is that when I click the link it doesn't work and nothing happens.

The code is this:

<?php 

$req= 'SELECT * from plot q, curse c where q.id_quest='.$data['id_q'].' and q.id_curs=c.id_cursus';
$result=mysql_query($req) or die('Erreur SQL !<br>'.$sql2.'<br>'.mysql_error()); 

$currentid=$data['id_q'];
$test='test';
$currentrep=$currentid.$test;


echo  '<a id='.$currentid.' href="javascript:toggle('.$currentid.','.$currentrep.');"><b>    <h8> Question : </b> '.$data['int_question'].'</h8><br></a>';

echo '<div  id='.$currentrep.' style="display: none"><b>Réponse </b> : '.$data['rep'].'<nbsp>';

?>

You have to escape quotations correctly to pass strings to the JS function:

echo  '<a id="'.$currentid.'" href="javascript:toggle(\''.$currentid.'\', \''.$currentrep.'\');"><b>    <h8> Question : </b> '.$data['int_question'].'</h8><br></a>';

echo '<div id="'.$currentrep.'" style="display: none"><b>Réponse </b> : '.$data['rep'].'<nbsp>';