php按钮调用php函数

I have that code to create a button

$button = "<input type='submit' id='liga' value='liga'>";
echo $button;

I have the php function

function liga(){
....}

as I do so by clicking the button it calls the function?

Using html this code works, but I really need use the php button, how can I make it?

<input type="submit" name="liga" value="liga" />
if (isset($_REQUEST['liga'])) {
    liga();
} elseif (isset($_REQUEST['desliga'])) {
    desliga();
}

This little snippet will take an array with the index being the name of the button and the value as the label the button should have. It will then make a button for each element of the array.

<?php
$foo = array('name'=>'label', 'name2'=>'label2');
foreach ($foo as $k=>$v)
    echo "<input type=\"submit\" name=\"$k\" value=\"$v\" />
";
?>

You can also put the PHP variable right inside the HTML code using <?=...?>:

<input type="submit" name="<?= $myPhpVar ?>" value="<?= $myOtherPhpVar ?>" />

Or you can put complicated expressions (or whole programs) using the typical <?php...?> tags inside HTML brackets - whatever it echod becomes the content of that html tag:

<input type="submit" name="<?php echo $myPhpVar; ?>" value="<?php echo "LABEL: ".$myOtherPhpVar; ?>" />

I found a solution

echo "<input type='submit' name='liga' value='Liga'>";
echo "<input type='submit' name='desliga' value='Desliga'>";