字段信息:logi_jo[varchar]、logi_cntrlnum[int]、logi_remark[varchar]、logi_poin[varchar]
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 + "&logi_cntrlnum=" + val2 + "&logi_remark=" + val3 + "&logi_poperson=" + val4;
点击提交后的网址:
sample_link.php?logi_jo=123a&logi_cntrlnum=000002&logi_remark=deliver&logi_poperson=chunkchunks
$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 => $value)
if($key != '') {
$sql .= "$key = '$value' && ";
}
}
$sql= substr_replace ($sql , '', strlen($sql) -3 , 2);
echo $sql;
输出:logi_jo = '1' && logi_cntrlnum = '2' && logi_remark = '3' && logi_poperson = '4'
问题:我如何修改输出.. 例如logi_remark 没有答案.. 其中准备输出变为: logi_jo = '123a' && logi_cntrlnum = '000002' && logi_remark = ''&& logi_poperson='chunkchunks'我该如何修改它像这样: logi_jo = '123a' && logi_cntrlnum = '000002' && logi_poperson='chunkchunks'(解释:如果变量等于零(0)或''(没有答案)它不会出现..)
最后,如果可能,如果字段是 [int] 它没有 '' 像这样 logi_cntrlnum = '000002' 它应该像这样 logi_cntrlnum = 000002 谢谢你 xD