title: Handling 2 arrays with difficult condition. [ PHP ]
body: <blockquote>
    <p>The Situation:
    This is like a loaning process where I can borrow money of a <strong>specific limit or amount</strong>.</p>
  </blockquote>
  
  <p>So, here.</p>
  
  <pre><code>&lt;label&gt; Select Limit &lt;/label&gt;
  &lt;select id="select_limit"&gt;
      &lt;option value="100"&gt; $100 &lt;/option&gt;
      &lt;option value="500"&gt; $500 &lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Now, after I select the <strong>$100</strong> option, I will be prompted, with how much of the $100 I want to cash out,</p>
  
  <pre><code>&lt;input type="text" value="100" id="how_much" /&gt;
  </code></pre>
  
  <p>The original value for the prompt is the limit I selected, so I want to cash out the whole <strong>$100</strong>.</p>
  
  <p>Now, the <code>select_limit</code> should now look like this,</p>
  
  <pre><code>&lt;select id="select_limit"&gt;
      &lt;option value="500"&gt; $500 &lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>The <strong>$100 dollar option</strong> is now gone because I cash it out <strong>whole</strong>.</p>
  
  <p>That part is easy, here's the problem.
  I want to cash out <strong>$300</strong> from the <strong>$500</strong> dollar option. What I want is for <code>&lt;option value="500"&gt; $500 &lt;/option&gt;</code> to still show from the options because I still have the remaining <strong>$200</strong> to borrow. </p>
  
  <p><strong>BUT I CAN'T GET IT TO WORK</strong></p>
  
  <blockquote>
    <p>DATABASE:</p>
  </blockquote>
  
  <pre><code>.---------------------.    .---------------------------.
  |LIMITS               |    |CASHED OUTS                |
  +---------------------+    +---------------------------+
  | id    | amount      |    | id  | limits_id  |  amount|
  +-------+-------------+    +-----+------------+--------+
  | 1     | 100         |    | 1   | 1          | 100    |
  +-------+-------------+    +-----+------------+--------+
  | 2     | 500         |    | 2   | 2          | 300    |
  +-------+-------------+    +-----+------------+--------+
  </code></pre>