我是用的普通按钮:
function check()
{
if(form1.sort.value=="")
{
alert('请选择小类别');
return false;
}
else
{
if(document.all.format[3].checked==true)
form1.memo.value=frames.message.document.body.innerHTML;
//alert("submit之前");
//form1.ACTION="savenews.php";
form1.submit();
//alert("submit之后"); return true;
}
} <FORM NAME="form1" METHOD=POST ACTION="savenews.php" ENCTYPE="multipart/form-data">
<?///////////////////?> <div align="center">
<input type="submit" name="Submit" value="添加" onclick="Javascript:return check();">
<input type="reset" name="Reset" value="重写">
</div>
function check()
{
if(form1.sort.value=="")
{
alert('请选择小类别');
return false;
}
else
{
if(document.all.format[3].checked==true)
form1.memo.value=frames.message.document.body.innerHTML;
//alert("submit之前");
//form1.ACTION="savenews.php";
form1.submit();
//alert("submit之后"); return true;
}
} <FORM NAME="form1" METHOD=POST ACTION="savenews.php" ENCTYPE="multipart/form-data">
<?///////////////////?> <div align="center">
<input type="submit" name="Submit" value="添加" onclick="Javascript:return check();">
<input type="reset" name="Reset" value="重写">
</div>
同意 ccterran(iwind) 的
if(form1.title.value=="")
{
alert('请输入资讯标题!');
form1.title.focus();
return false;
}else{
if(document.all.format[3].checked==true)
form1.memo.value=frames.message.document.body.innerHTML;
//alert("submit之前");
//form1.ACTION="savenews.php";
form1.submit();
//alert("submit之后");
form1.title.value=="";
return true;
}
}
//......
<FORM NAME="form1" METHOD=POST ACTION="savenews.php" ENCTYPE="multipart/form-data"><tr>
<td bordercolor="#FFFFFF" colspan="4" height="22">
<div align="center">
<input type="button" name="ss" value="添加" onclick="Javascript:return check();">
<input type="reset" name="Reset" value="重写">
</div>
</td>
</tr></FORM>
------------------------------------------------------------------
提交到:
$sql="insert into ......";
$db->query($sql);$fname="MSN.txt";
if(!($theOpenFile=fopen($fname,"r+"))){
echo "文件打开失败!请检查";
exit;
}
$theNum=fgets($theOpenFile,255);
fclose($theOpenFile);
if(!($theOpenFile=fopen($fname,"w"))){
echo "文件写入失败!请检查";
exit;
}$theNum++;
fputs($theOpenFile,$theNum);
fclose($theOpenFile);Header("Location: addnews.php?sort=$sort&format=$format");
}
------------------------------------------------------------------
奇怪的是:
我的那个文本计数器 $fname="MSN.txt"; 只增加了1,表明:那个insert 操作只执行了一次