Here is my code to create the buttons
<?php
foreach($array as $x){
if($x !== "0"){
echo('<button class="tablink" onclick="openEvent(event,'. $x . ')">'. "Event ". $x .'</button>');
}
}
?>
and here is my code to open the tab
<script>
function openEvent(e, et) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elemen