formating the result of foreach
<p>fields info: logi_jo[varchar], logi_cntrlnum[int], logi_remark[varchar], logi_poin[varchar]</p>

<pre><code>var val = document.getElementById("logi_jo").value;
var val2 = document.getElementById("logi_cntrlnum").value;
var val3 = document.getElementById("logi_remark").value;
var val4 = document.getElementById("logi_poperson").value;
document.location.href = "ppc_logistic-mngt_home2.php?logi_jo=" + val + "&amp;logi_cntrlnum=" + val2 + "&amp;logi_remark=" + val3 + "&amp;logi_poperson=" + val4;
</code></pre>

<p><strong>URL after clicking submit:</strong> </p>

<p>sample_link.php?logi_jo=123a&amp;logi_cntrlnum=000002&amp;logi_remark=deliver&amp;logi_poperson=chunkchunks</p>

<pre><code>$logi_jo = $_REQUEST['logi_jo'];
$logi_cntrlnum = $_REQUEST[logi_cntrlnum];
$logi_remark = $_REQUEST['logi_remark'];
$logi_poin = $_REQUEST['logi_poperson'];

if(isset ($_GET)) {
  foreach ($_GET as $key =&gt; $value)

  if($key != '') {
    $sql .= "$key = '$value' &amp;&amp; "; 
  }
}

$sql= substr_replace ($sql , '', strlen($sql) -3 , 2);
echo $sql;
</code></pre>

<p>OUTPUT: logi_jo = '1' &amp;&amp; logi_cntrlnum = '2' &amp;&amp; logi_remark = '3' &amp;&amp; logi_poperson = '4'</p>

<p>Question:how can i modify the output.. for example <strong>logi_remark is no answer</strong>.. inwhich the prepare <strong>output became:</strong> logi_jo = '123a' &amp;&amp; logi_cntrlnum = '000002' &amp;&amp; logi_remark = ''&amp;&amp; logi_poperson='chunkchunks' <strong>how can i modify it like this:</strong> logi_jo = '123a' &amp;&amp; logi_cntrlnum = '000002' &amp;&amp; logi_poperson='chunkchunks'(explanation: if the variables is equal to zero(0) or ''(no answer) it will no appear..) </p>

<p>and last if it is possible if the fields is [int] it does not have '' like this logi_cntrlnum = '000002' it should be like this logi_cntrlnum = 000002 thank u xD</p>
