php表单事件触发条件,javascript-onsubmit触发事件把表单数据发送到相关php处理问题...

问题详情:onsubmit触发事件把表单数据发送到相关php处理但是如何避免数据有问题时也会触发事件呢?function dosubmit(){ window.open('num3.php?cf='+window.form.cf.value+'&cf1='+window.form.cf1.value); }

require_once('appvars.php');

require_once('connectvars.php');

if(isset($_POST['submit'])){ //第10行

$name=$_POST['name'];

$score=$_POST['score'];

$st=$_FILES['st']['name'];

$st_type=$_FILES['st']['type'];

$st_size=$_FILES['st']['size'];

$output_form=false;

if( empty($name) || empty($score) || empty($st))

{

echo'Something is wrong !

';

$output_form=true;

}

//第20行

else{

if( (($st_type=='image/gif')||($st_type=='image/jpeg')||($st_type=='image/pjeg')||($st_type=='image/png')) && ($st_size >0) && ($st_size <=MAX_FILE_SIZE) )

{

if($_FILES['st']['error']==0){

$target=GW_UPLOADPATH .$st;

//第30行

if(move_uploaded_file($_FILES['st']['tmp_name'],$target)){

$dbc=mysqli_connect(HOST,USER,PASSWORD,NAME);

$st=$_FILES['st']['name'];

$query="INSERT INTO b (date,st,score,name)".

"VALUES(NOW(),'$st','$score','$name')";

//第40行

mysqli_query($dbc,$query)

or die('UU');echo'You are success to add dates to Mysql '.'

';echo 'Name :'.$name.'

';echo 'Score : '.$score.'

';echo 'Photo :'.'

'.GW_UPLOADPATH.%24st.''; //第50行 echo'

//clear the score datas

$name="";

$score="";

$st="";

mysqli_close($dbc);

}//if(move_uploaded_f

else

{

echo $_FILES['st']['error'];

echo'

文件没有移动成功 !!';//第60行

}

}//if($_FILES['st']['error']

else

echo'There is something wrong to upload the file ! Plese upload it agian.';

}//if(($st_type=='image/gif'

else echo'

The screen pic must be a GIF,JPEG, or PNG image and the file '.'size must fit '.'(MAX_FILE_SIZE/1024)'.'KB.';}//else //第70行

//Try to delete the temporary screen shot image file.

@unlink($_FILES['st']['tmp_name']);

}else $output_form=true;

if($output_form){

?>Your name:

Your score:

Your Photo:

商品交易; 商品互换;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值