Saturday, 24 August 2013

assignment within an echo statement

assignment within an echo statement

In my PHP file, I have an echo statement, that outputs some HTML, within
which i want to do some assignment based on onclick event.
echo "<td style='padding:10px; text-align:left;'> <a target='_blank'
href='stat.php' onclick='". $_SESSION['dakno'] = $r[$j]; ."'
>".$r[$j]."</a></td>";
I have tried a lot of combinations, but still getting syntax error because
of the onclick section.
echo "<td style='padding:10px; text-align:left;'> <a target='_blank'
href='stat.php' onclick='"<?php $_SESSION['dakno'] = $r[$j]; ?> "'
>".$r[$j]."</a></td>";
Please, help me to remove the syntax error I am making.

No comments:

Post a Comment