<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
</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
另外enctype="multipart/form-data"这句有什么用。你要上传文件吗。
你可以先输出一下$_REQUEST["insertproduct"]看有值吗
是的,需要上传文件的,就是一个发布商品的页面,因为不判断ISSET 发现网页关闭后在打开会自动插入一条空的商品,所以我要判断是否是用户提交的商品
该方法提交表单的方式与用户单击 Submit 按钮一样,但是表单的 onsubmit 事件句柄不会被调用不知道onsubmit 和 submit 有什么区别呢?$_REQUEST["insertproduct"] 这个我没测试,等明天在测试把,先睡觉了
不过 $_REQUEST["insertproduct"],insertproduct是button,有值吗?