Note that there are some explanatory texts on larger screens.

plurals
  1. POIf variable is set, show $_SESSION data
    text
    copied!<p>I have a hard time with isset() function. Exactly how do I tell php that only if the data was assigned to my, lets say $_SESSION['msg']; variable, only then activate it and use it... So far I am getting a lot of notices: undefined index and this code doesn't do it also: </p> <pre><code>if (isset($_SESSION['monster']) &amp; isset($_SESSION['spol']) &amp; isset($_SESSION['combat']) &amp; isset($_SESSION['turns']) &amp; isset($_SESSION['zmaga']) &amp; isset($_SESSION['zguba']) &amp; isset($_SESSION['cekini']) &amp; isset($_SESSION['post']) ) { $monster = $_SESSION['monster']; $spol = $_SESSION['spol']; $combat = $_SESSION['combat']; $turns = $_SESSION['turns']; $zmaga = $_SESSION['zmaga']; $zguba = $_SESSION['zguba']; $cekini = $_SESSION['cekini']; $_POST = $_SESSION['post']; } </code></pre> <p>Data was supposed to be asigned to it from a redirecting previous site but that site doesn't always activate so I need an alternative. That's why I am asking this.</p> <p>EDIT with full code:</p> <pre><code>session_start(); include 'razno.php'; include 'save.php'; include 'stats.php'; $igralec_ime = $_SESSION['username']; $monster = prikazi_borba($igralec_ime); $poskodbe = prikazi_stat('curhp', $igralec_ime); if (prikazi_stat('curhp', $igralec_ime) == 0) { $moznost = 'Tvoje zdravje je resno ogroženo, vrni se domov!'; } else if (isset($_SESSION['monster']) &amp;&amp; isset($_SESSION['spol']) &amp;&amp; isset($_SESSION['combat']) &amp;&amp; isset($_SESSION['turns']) &amp;&amp; isset($_SESSION['zmaga']) &amp;&amp; isset($_SESSION['zguba']) &amp;&amp; isset($_SESSION['cekini']) &amp;&amp; isset($_SESSION['post']) ) { $monster = $_SESSION['monster']; $spol = $_SESSION['spol']; $combat = $_SESSION['combat']; $turns = $_SESSION['turns']; $zmaga = $_SESSION['zmaga']; $zguba = $_SESSION['zguba']; $cekini = $_SESSION['cekini']; $_POST = $_SESSION['post']; } update_save($igralec_ime, 'gozd', $monster); include '../html/gozd.html'; ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload