title: Undefined variable when calling an id from api
body: <p>I'm working on a PHP project the teacher gave us, basically we have to make a website dynamic and create a liste.php with tasks stored in an API the teacher has.</p>
  
  <p>So I have the index.php with the front page on it and the list of all the projects going on ( like trip preparation, shopping list and appartment decoration ). I created a liste.php with all the tasks contained in each project ( buying tickets, booking the hotel and buying a postcard for the trip preparation ). </p>
  
  <p>Now I have to get all the tasks of each project from the API he gave us. </p>
  
  <p>Here's the API</p>
  
  <p><a href="http://todo_api.xx.firstname-lastname.com/tache.php?liste_id=1" rel="nofollow noreferrer">http://todo_api.xx.firstname-lastname.com/tache.php?liste_id=1</a> </p>
  
  <p>That's the API for project n°1, there are 3 projects in total ( I mentionned them all above )</p>
  
  <p>I also have a functions.php with the $api_url stored, and 2 functions, one getting the list of projects, the other getting the tasks for each project.</p>
  
  <pre><code>$api_url = "http://todo_api.xx.firstname-lastname.com/";
  
  
  function getAllListes(): array {
      global $api_url;
  
      $json = file_get_contents($api_url . "liste.php");
      return json_decode($json, true);
  }
  
  
  
  function getAllTaches(): array {
      global $api_url;
      $json = file_get_contents($api_url . "tache.php?liste_id=" . $id);
      return json_decode($json, true);
  }
  </code></pre>
  
  <p>But when I try to print_r that, or even just display each task, I get this :</p>
  
  <p>Notice: Undefined index: liste_id in /Applications/MAMP/htdocs/todo/database/functions.php on line 17</p>
  
  <p>So obviously something is wrong, and this keeps me from going on. Any idea ?</p>
  
  <p>Edit : here's my html/php code regarding the tasklist</p>
  
  <pre><code>$listes = getAllListes();
  $taches = getAllTaches($id);
  
  &lt;ul&gt;
  
          &lt;?php foreach ($taches as $tache) : ?&gt;
          &lt;li&gt;&lt;?php echo $tache["libelle"] ;?&gt;&lt;/li&gt;
          &lt;?php endforeach ; ?&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>libelle is the index of the information required.</p>
  
  <p>Thanks a lot !</p>