Place a onCLICK inside a PHP echo
<p>I have the following code</p>

<pre><code>&lt;table width="100%" border="1" cellpadding="15" align="center"&gt;
&lt;?php
$res = $dbcon-&gt;query("SELECT * FROM actor");

while($row=$res-&gt;fetch_array())
{
?&gt;
 &lt;tr&gt;
&lt;td&gt;&lt;?php echo $row['actor_id']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="?del=&lt;?php echo $row['actor_id']; ?&gt;" onclick="return confirm('sure to delete !'); " &gt;delete&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;?php
}
?&gt;
</code></pre>

<p>This works fine in every way but the problem is that i cant seem to set the <strong>onclick</strong> to work onside an <strong>echo</strong> in this next piece of code.
I'm learning mysql/php so i'm experimenting with various codes.</p>

<pre><code>FOR ($j=0 ; $j &lt; $rows; ++$j) {

   $result-&gt;data_seek($j);
   $row = $result-&gt;fetch_array(MYSQLI_ASSOC);
   echo 'Actor ID: ' . $row['actor_id'] . '&lt;br&gt;';
   echo '&lt;a href="?del='.$row['actor_id'].'"&gt;Delete&lt;/a&gt;'. '&lt;br&gt;&lt;br&gt;';                       
}
$result-&gt;close();
$conn-&gt;close();
?&gt;
</code></pre>

<p>The delete button works i just don't have a warning anymore, i can't figure out 
how to properly insert <strong>onclick="return confirm('sure to delete !')</strong></p>