Isset in function works by itself. php
The code should call the setbatts function, and then wait until I click on the button, but it will not happen. Instead, the code is triggered under conditions. What to do with this, please help.
<?php require "php/include_db.php"; $array_buttons = array($_POST['location_button_1'], $_POST['location_button_2'], $_POST['location_button_3'], $_POST['location_button_4']); $src = null; $locationInfo = R::load('locationsdb', 1); $src = $locationInfo->location_image; echo $src; setButton($locationInfo->location_travel); function setButton($locationInfo_travel){ acv = $_POST; $arr_travels = explode(' ', $locationInfo_travel); for($i=0; $i<count($arr_travels); $i++){ echo ", ", $arr_travels[$i]; } if(isset ($acv['location_button_1'])){ $locationInfo = R::load('locationsdb', $arr_travels[0]); $src = $locationInfo->location_image; echo $src; setButton($locationInfo->location_travel); }if(isset ($acv['location_button_2'])){ $locationInfo = R::load('locationsdb', $arr_travels[1]); $src = $locationInfo->location_image; echo $src; setButton($locationInfo->location_travel); }if(isset ($acv['location_button_3'])){ $locationInfo = R::load('locationsdb', $arr_travels[2]); $src = $locationInfo->location_image; echo $src; }if(isset ($acv['location_button_4'])){ $locationInfo = R::load('locationsdb', $arr_travels[3]); $src = $locationInfo->location_image; echo $src; } } ?>
html:
<div class="location_buttons_container"> <div class="buttons_container"> <form method="post" action="Game.php"> <ul class="buttons_menu"> <li>Локации</li> <li ><span ><button id="location_button_1" name="location_button_1" >Главные ворота</button></span><em>3 сек.</em></li> <li><span><button name="location_button_2">Торговый квартал</button></span><em>2 сек</em></li> <li><span><button name="location_button_3">Замок</button></span><em>5 сек</em></li> <li><span><button name="location_button_4">Гильдия</button></span><em>4 сек</em></li> </ul> </form> </div> </div>