Event handler does not work in php function called

Sorry to ask this question for the 2nd time, but I really need help with this piece of code. I have to call the function, setting the parameters for the action of the buttons, where there will be a recursion but with different parameters. But if (isset) is simply called by itself without clicking a button. Please tell me what the problem is. Do not throw sticks, I’m a beginner. If you change isset to! Empty, then pressing does not work at all

<?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){             $arr_travels = explode(' ', $locationInfo_travel);             for($i=0; $i<count($arr_travels); $i++){             echo ", ", $arr_travels[$i];             } if(isset ($_POST['location_button_1'])){             $locationInfo = R::load('locationsdb', $arr_travels[0]);             $src = $locationInfo->location_image;             echo $src;             setButton($locationInfo->location_travel); }if(isset ($_POST['location_button_2'])){             $locationInfo = R::load('locationsdb', $arr_travels[1]);             $src = $locationInfo->location_image;             echo $src;             setButton($locationInfo->location_travel); }if(isset ($_POST['location_button_3'])){             $locationInfo = R::load('locationsdb', $arr_travels[2]);             $src = $locationInfo->location_image;             echo $src; }if(isset ($_POST['location_button_4'])){             $locationInfo = R::load('locationsdb', $arr_travels[3]);             $src = $locationInfo->location_image;             echo $src;  } } ?> 

Form:

<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> 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.