20 buttons for one php program

How can I attach 20 buttons to one program and so that each button has aktion=”card.php”, but when you click different buttons, the corresponding actions are performed in the php program?


Answer 1

There is such a thing as a function argument, there can be more than one. Sample code :

<script type="text/javascript">
var pg;
function fc (pg) {
 if (pg == 'home') {
  alert('home okok');
 }
}
</script>
<input type="button" onclick="fc('home')" value="" />

There can be multiple arguments.

Regarding the connection with PHP, read article.

Added from comment.

Like this:

<a href="?param=ololo">link!1</a>
<?php
if ($_GET['param'] == 'ololo') {
 echo 'ololo now!1';
}
?>