| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/projects/netnode_data1/ |
Upload File : |
<html>
<head>
<title>
How to call PHP function
on the click of a Button ?
</title>
</head>
<body style="text-align:center;">
<h1 style="color:green;">
PRIKAZ PODATAKA SA IoT UREDJAJA
</h1>
<h3 style="color:blue;">
</h3>
<?php
if(array_key_exists('button1', $_POST)) {
button1();
}
else if(array_key_exists('button2', $_POST)) {
button2();
}
function button1() {
echo "This is Button1 that is selected";
}
function button2() {
echo "This is Button2 that is selected";
}
?>
<style>
table, td, th {
border: 1px solid blue;
}
table.center {
margin-left: auto;
margin-right: auto;
}
td, th {
height: 50px;
vertical-align: center;
text-align: center;
}
.button: hover {
background-color: white;
color: blue;
width: 250px;
border: 2px solid blue;
vertical-align: center;
}
.button1 {font-size: 20px;}
}
</style>
<table class="center">
<tr bgcolor="#90ee90">
<th><font size="5" face="Sans Sherif" color="green">KOMANDA</font></th>
<th><font size="5" face="Sans Sherif" color="green">OPIS KOMANDE</font></th>
<th><font size="5" face="Sans Sherif" color="green">LOKACIJA IoT</font></th>
</tr>
<tr bgcolor="fff8dc">
<td><form method="get" action="http://rasin.ddns.net/projects/netnode_data1/start.php"><button class="button button1">Podaci sa BME280</button></td>
<td><font size="4" face="Sans Sherif" color="#0000ff"><b>Prikaz podataka sa senzora BME280</b> - Pritisak, Temperatura, Vlaznost, Nadmorska visina</font></td>
<td><font size="4" face="Sans Sherif" color="#0000ff">Radna soba - Sinisa</font></td>
</tr>
<tr bgcolor="#fff8dc">
<td><form method="get" action="http://rasin.ddns.net/projects/netnode_data1"><button class="button button1">Senzor prasine</button></td>
<td><font size="4" face="Sans Sherif" color="#0000ff"><b>Prikaz podataka sa senzora prasine</b></font></td>
<td><font size="4" face="Sans Sherif" color="#0000ff">Radna soba - Sinisa</font></td>
</tr>
</table>
</head>
</html>