Sunday, 26 March 2017

Passing PHP variable to JavaScript Button Click Function

Here's how to pass your PHP variable to a JavaScript button Click function

The variable is  $username

and here's how to pass it to onClick function

echo "<td><input type=\"button\" value=\"Edit\" onClick=\"editItem('".$username."')\"> <a href=\"delete.php\" onClick=\"return confirm('Are you sure you want to delete?')\">Delete</a></td>";

No comments:

Post a Comment