Hi, i'm trying to develop this page but it seems to be a problem in the interaction between PHP and javascript. The deal is that the HTML and javascript codes are created dynamically by the PHP code and it is created properly as I've seem in the source code generated by de navigator (IE, chrome and Mozilla)... but they keep not working...
the PHP code tha generates de 'function call' in javascript is:
//Faz a busca pelos dados na tabela do ano selecionado
$result = mysql_query("SELECT * FROM Ano" . $ano_tabela['Ano'] . " ORDER BY Placas ASC");
for ($i=1; $row = mysql_fetch_array($result); $i++)
{
echo '<tr><td class="border3">' . $row['Placas'] . '</td><td class="border3">' . $row['Status'] . '</td>';
//Estrutura de repetição para escrever as semanas
for($i=1; $i<($num_semanas+1); $i++)
{
//Define a cor do background da celula de acordo com o conteúdo
if($row['Week' . $i] == "P")
{
$color = "#FFFF00";
}
elseif($row['Week' . $i] == "1" || $row['Week' . $i] == "2" || $row['Week' . $i] == "3")
{
$color = "#4D70B8";
}
elseif($row['Week' . $i] == "S")
{
$color = "#99FF66";
}
else
{
//Se for a semana atual fica preenchida de laranja
if($i==date("W") && $ano_tabela['Ano']==date("Y"))
{
$color = "#FFB280";
}
else
{
$color = "#ffffff";
}
}
$comment = $i;
//This generates a link tha calls the function updateDiv(a,b,c,d)
if($row['Week' . $i] == "" || $row['Week' . $i] == NULL)
{
echo '<td id="link_td" style="background-color:' . $color . ';"><a href="#" onclick="updateDiv(' . $i . ',' . $num_semanas . ',' . $row['Week' . $i] . ',' . $comment . ')">-</a></td>';
}
else
{
echo '<td id="link_td" style="background-color:' . $color . ';"><a href="#" onclick="updateDiv(' . $i . ',' . $num_semanas . ',' . $row['Week' . $i] . ',' . $comment . ')">' . $row['Week' . $i] . '</a></td>';
}
}
echo '</tr>';
}
the problem is not html or javascript because it does't even call the function... the error happens before that...
the thing is the '$row['Week' . $i]' part, because if I specify just the the parameter a and b of the function it works, like this: updateDiv(a,b).
Even if in the place of '$row['Week' . $i]' I put a string it wont work, it just worked when used a random variable in there (like $i)...
please, someone know what it could possibly be?