title: Select shipping cost based on largest size in shopping cart
body: <p>Okay, so I have a shopping cart that I built my self that allows customers to add pictures to a shopping cart, select a size of the picture, and then checkout. </p>
  
  <p>I am going to charge <strong>$2.99</strong> for orders containing no picture larger than a <strong>8x12</strong> and <strong>$4.99</strong> for orders with pictures <strong>10x12</strong> and upwards. </p>
  
  <p>My sizes are selected through a <code>&lt;select&gt;</code> and then stored in a session like: <code>$_SESSION['shipping'][$id]</code> You can see the select below. </p>
  
  <pre><code>&lt;select class="form-control" id="sizeSelector"&gt;
     &lt;option&gt;Select a Size&lt;/option&gt;
     &lt;option&gt;4x4&lt;/option&gt;
     &lt;option&gt;4x6&lt;/option&gt;
     &lt;option&gt;5x7&lt;/option&gt;
     &lt;option&gt;6x6&lt;/option&gt;
     &lt;option&gt;8x8&lt;/option&gt;
     &lt;option&gt;8x10&lt;/option&gt;
     &lt;option&gt;8x12&lt;/option&gt;
     &lt;option&gt;10x12&lt;/option&gt;
     &lt;option&gt;12x16&lt;/option&gt;
     &lt;option&gt;4x18&lt;/option&gt;                    
  &lt;/select&gt;
  </code></pre>
  
  <p>I don't want the shipping stored along with the id, because it needs to be an overall count of every item in the shopping cart. If any items are larger than 8x12 then the shipping for the entire order needs to be $4.99. </p>
  
  <p>I tried doing the following inside the script that sets the size session, but it always results in $2.99 regardless the size selected. </p>
  
  <pre><code>if ($size &lt;= '8x12') {
     $_SESSION['shipping'] = '2.99';
  }
  else {
     $_SESSION['shipping'] = '4.99';
  }
  </code></pre>
  
  <p>The above is a snippet out of this code below: (snippet included)</p>
  
  <pre><code>&lt;?php 
  
    session_start();
  
    require '../config/connect.php';
  
    $id = $_POST['id'];
  
    $_SESSION['size'][$id] = $_POST['size'];
  
    $category = $_SESSION['category'];
  
    $size = $_SESSION['size'][$id];
  
    $result = mysqli_query($con,"SELECT * FROM items_info WHERE type='".$size."'");
  
    while($row = mysqli_fetch_array($result))
    {
      $_SESSION['cost'][$id] = $row['price'];
  
      if ($size &lt;= '8x12') {
          $_SESSION['shipping'] = '2.99';
      }
      else {
          $_SESSION['shipping'] = '4.99';
      }
  
    }
  
  ?&gt;
  </code></pre>
  
  <p>So basically, I need to some how run through all the sessions set for size and if anything is larger than 8x12 set the shipping session to $4.99. else set the shipping to $2.99.</p>
  
  <p>Any help would be greatly appreciated! </p>