PHP check if not empty and the value of another GET
<p>I have a POS and need to check 2 things before I save a sale in MySQL</p>

<p>Code to get and check the information I need</p>

<pre><code>$invoice=mysqli_real_escape_string($db,$_POST['same_invoice']);
$customer=mysqli_real_escape_string($db,$_POST['same_customer']);
</code></pre>

<p>If invoice is empty the customer is also empty because is the first prodyct in this invoice so we assign a invoice number and we ask the customer to show identification, the invoice is generated automatic so we input the ID-number of the customer and save to MySQL</p>

<p>Now the problem</p>

<p>If the customer wants to buy 2 products we dont need to give the order a new invoice number neither the ID but we must check both in MySQL</p>

<p>code I am trying but not working</p>

<pre><code>if( $invoice is empty &amp;&amp; $customer is also empty)
{ we create new invoice an ask customer for id first time }
if( $invoice is empty &amp;&amp; $customer is NOT empty)
{ we create new invoice but do not ask customer for id }
else
{ we use the $invoice and $customer comming from the form }
</code></pre>

<p>Any idea how to check that?</p>