title: populating multiple html fields with specific values from mysql database
body: <p>I've got 2 pages, one where the user will input how many of each item they desire and then when button is clicked, the values will be stored to a mysql table and the page will redirect to the 'print-format page' where I want the most recent set of data to be displayed in the correct fields. So far i've got the inputted data to write to the database on the click of the button but I can't work out how to display it in the second page.</p>
  <pre><code>  //Default List Values
  $whiteList = array(
      'orderLT' =&gt; '',
      'shopLT' =&gt; '',
      'orderLF' =&gt; '',
      'shopLF' =&gt; '',
      'orderLD' =&gt; '',
      'shopLD' =&gt; ''
  );
  
  //Add List quantities to Database
  if (isset($_POST['create'])) {
      $stmt = $pdo-&gt;prepare('INSERT IGNORE INTO whiteList (orderLT,shopLT,orderLF,shopLF,orderLD,shopLD,orderLB,shopLB,orderSand,shopSand,orderLC,shopLC) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)');
      $stmt-&gt;execute([ $_POST['orderLT'], $_POST['shopLT'], $_POST['orderLF'], $_POST['shopLF'], $_POST['orderLD'], $_POST['shopLD'], $_POST['orderLB'], $_POST['shopLB'], $_POST['orderSand'], $_POST['shopSand'], $_POST['orderLC'], $_POST['shopLC'] ]);
      header('Location: whiteprintable.php');
  }
  </code></pre>
  <p>This allows the inputs to be added to the database</p>
  <p>But despite trying lots of different examples on how to populate the next page with the corresponding values, it's not working properly?</p>
  <p>there are multiple input fields on the first page (displayed in tables) all the same format as:</p>
  <pre><code>&lt;th class=&quot;rowHeader&quot; scope=&quot;row&quot;&gt;Long Tin&lt;/th&gt;
                                          &lt;td&gt;&lt;input type=&quot;number&quot; class=&quot;listInput&quot; id=&quot;orderLT&quot; name=&quot;orderLT&quot; value=&quot;&lt;?=$whiteList['orderLT']?&gt;&quot; required&gt;&lt;/td&gt;
                                          &lt;td&gt;&lt;input type=&quot;number&quot; class=&quot;listInput&quot; id=&quot;shopLT&quot; name=&quot;shopLT&quot; value=&quot;&lt;?=$whiteList['shopLT']?&gt;&quot; required&gt;&lt;/td&gt;
  </code></pre>
  <p>and I want it to populate the corresponding fields in the 'print format page'. I've tried this:</p>
  <pre><code>&lt;input class=&quot;listInput&quot; type=&quot;text&quot; id=&quot;orderLT&quot; name=&quot;orderLT&quot; value=&quot;&lt;?php echo $whiteLists[orderLT]?&gt;&quot;/&gt; 
  </code></pre>
  <p>with this in the php code at the top of the page :</p>
  <pre><code>    $stmt = $pdo-&gt;prepare('SELECT * FROM whiteLists WHERE id &gt;=MAX(id)');
  $stmt-&gt;execute();
  $whiteLists = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
  </code></pre>
  <p>but it doesn't work</p>
  <p>Please could someone explain a good way to achieve this? :)</p>