0
I have a code where I need to put inside a javascript a variable that is the ID of the person I’m pulling, but I can’t find the solution. Where am I going wrong?
<?php echo "
<tr>
<td>".$row['nome']."</td>
<td>".$row['telefone']."</td>
<td>".$idade."</td>
<td>".$row['cidade']."</td>
<td>".$row['cargo_pretendido']."</td>
<td><button onclick='mostrar()' class='w3-button w3-black'>INFOk123</button><td>
</tr>
<div id='id\"$row['id']\"' class='w3-modal'>
<div class='w3-modal-content'>
<header class='w3-container w3-teal'>
<span onclick='sumir()' class='w3-button w3-display-topright'>×</span>
</header>
<p>Teste</p>
</div>
</div>
";
}
echo "<br>";
}
?>
<script language="javascript" type="text/javascript">
function mostrar() {
document.getElementById('id"<?php echo $row['id']; ?>"').style.display='block';
}
function sumir() {
document.getElementById('id"<?php echo $row['id']; ?>"').style.display='none';
}
</script>
Here:
document.getElementById('id<?php echo $row['id']; ?>').style.display='block';
and here:<div id='id".$row['id']."' class='w3-modal'>
– Sam