<form method="post" name="addprod" id="addprod" enctype="multipart/form-data" target="norefresh"><input id="insertproduct" type="button" name="insertproduct" onclick="add_product()" value="发布产品" />
</form>form  是post
表单提交按钮不是SUBMIT JSfunction add_product()  // 添加产品
{
if((document.getElementById("a_m").value != "") && (document.getElementById("a_b").value != ""))
{
var x = document.getElementById('addprod');
var xx = navigator.appName == 'Microsoft Internet Explorer' ? document.frames("bbcode").document.frames("contents").document.body.innerHTML : document.getElementById( "bbcode").contentWindow.document.getElementById( "contents").contentWindow.document.body.innerHTML;
x.action ="add_product.php?action=addproduct&xxx="+xx; 转向页面
x.submit() // 有SUBMIT

}
}
为什么我在ADD.PRODUCT 页面 用if(isset($_REQUEST["insertproduct"]))
{ 代码 }判断不了,都是FALSE

解决方案 »

  1.   

    因为 insertproduct 没有传递过去.自己分析一下传递的值就知道了.
      

  2.   

    先判断你的表单提交了没?
    另外enctype="multipart/form-data"这句有什么用。你要上传文件吗。
    你可以先输出一下$_REQUEST["insertproduct"]看有值吗
      

  3.   

    大哥你的js有错误的!你贴得代码不全啊 ?你的页面在点击button后有页面的跳转吗?
      

  4.   


    是的,需要上传文件的,就是一个发布商品的页面,因为不判断ISSET 发现网页关闭后在打开会自动插入一条空的商品,所以我要判断是否是用户提交的商品
      

  5.   

    哦。。不说清楚点。代码也不全,那你输出一下$_REQUEST["insertproduct"]看有值吗
      

  6.   

    我查了下资料,
    该方法提交表单的方式与用户单击 Submit 按钮一样,但是表单的 onsubmit 事件句柄不会被调用不知道onsubmit  和 submit 有什么区别呢?$_REQUEST["insertproduct"]  这个我没测试,等明天在测试把,先睡觉了
      

  7.   

    LZ的代码看得我直迷糊。。很少用这种风格 不太熟悉
    不过 $_REQUEST["insertproduct"],insertproduct是button,有值吗?