Hello, In php is there any way to make the button below call the power off function ()
$button2 = "<input type='button' id='php_button' value='desliga' onclick='desliga()'>";
echo $button;
clicking the button displays the error: Uncaught ReferenceError: off is not defined onclick
I'll better explain what I need.
I need to create some buttons dynamically because the number of buttons can change. For example it may be that I need 5 buttons with different names that call the same function.
Using only html as described below works, but this way I can not create the buttons dynamically. In the way described below the code works, but what I want is to be able to create as many buttons as I want according to the num_rows result of a sql query.
<?PHP
function liga(){
echo "teste";
}
<input type="submit" name="liga" value="liga"/>
if (isset($_REQUEST['liga'])) {
unset($_REQUEST['liga']);
liga();
? >