easyUI 通过ajax的不二秘诀提交Form

会生成一份 xls 文件,结果是没有结果,和phone 字段.通过使用form 插件我们改变form为ajax form,form提交所有,                                                                                         

无论是填点数据,然后交给,会生成风华正茂份 xls 文件。

 

 function php_sava($str)
 {
  $farr = array(
   “/s+/”,                                                                                         
   “/<(/?)(script|i?frame|style|html|body|title|link|meta|?|%)([^>]*?)>/isU”,  
   “/(<[^>]*)on[a-zA-Z]+s*=([^>]*>)/isU”,                                     
   
    );
    $tarr = array(
   ” “,
   “<\1\2\3>”,          
//若是要平昔歼灭不安全的价签,这里能够留空
   “\1\2”,
    );
 
   $str = preg_replace( $farr,$tarr,$str);
    return $str;
 }
 
 function stop_outside_post(){
  $ServerName = @$_SERVER[‘SERVER_NAME’];
  $Sub_from = @$_SERVER[“HTTP_REFERER”];
  $Sub_len = strlen($ServerName);
  $Checkfrom = substr($Sub_from,7,$Sub_len);
  if($Checkfrom!= $ServerName){
   die(“警报!你正在从表面提交数据或直接待上访谈c.php文件!请立刻终止!!”卡塔尔国;
   
  }
 }
 
  function get_real_ip(){
    $ip=false;
    if(!empty($_SERVER[“HTTP_CLIENT_IP”])){
     $ip = $_SERVER[“HTTP_CLIENT_IP”];
    }
    if (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR’])) {
     $ips = explode (“, “, $_SERVER[‘HTTP_X_FORWARDED_FOR’]);
     if ($ip) { array_unshift($ips, $ip); $ip = FALSE; }
     for ($i = 0; $i < count($ips); $i++) {
      if (!eregi (“^(10|172.16|192.168).”, $ips[$i])) {
       $ip = $ips[$i];
       break;
      }
     }
    }
    return ($ip ? $ip : $_SERVER[‘REMOTE_ADDR’]);
  }
?>
本站原创www.111cn.net/phper/php.html

header(“Cache-Control: public”);
那自然要加,否则的话,在IE下会爆发错误。

@author YHC

<?php
include_once(“inc/connect.php”);
stop_outside_post();
$email =php_sava(addslashes(isset($_POST[’email’])?$_POST[’email’]:”));
$mobile =php_sava(addslashes(isset($_POST[‘mobile’])?$_POST[‘mobile’]:”));
$name =php_sava(addslashes(isset($_POST[‘name’])?$_POST[‘name’]:”));
$an =php_sava(addslashes(isset($_POST[‘an’])?$_POST[‘an’]:”));
$ip = get_real_ip();
$time  =date(“Y-m-d”);
 if(empty($mobile) || empty($email) || empty($name) || empty($an)){
   die(‘submit=false’);
  }else{
   $tsql = “Select * from lzlj_an where ip=’$ip'”;
   $r = mysql_query($tsql);
   if( mysql_num_rows($r) ){
    die(‘submit=false’);
   }else{
    $sql =”Insert into lzlj_an(mobile,email,name,an,ip,dtime)
value(‘$mobile’,’$email’,’$name’,’$an’,’$ip’,’$time’)”;
    mysql_query($sql) or die(‘submit=false’);
    die(‘submit=true’);
   }
  }

再有叁个小难点从未找寻来,这么些模板,只可以有两笔数量,多了也不行,晕,还向来不找到要校订何地吗。

 查看   Demo

$token = $_POST[‘token’];

 

$arr = array(
‘name’ => $names[$i],
‘scoreA’ => $scoreAs[$i],
‘scoreB’ => $scoreBs[$i],
‘scoreC’ => $scoreCs[$i]
);
array_push($score,$arr);
unset($arr);
}

$(‘#ff’).form({ 
    success:function(data){ 
        $.messager.alert(‘Info’, data, ‘info’); 
    } 
}卡塔尔(قطر‎;  服务器端代码
form1_proc.php

for($i=0;$i$arr = array(
‘name’ => $names[$i],
‘sexs’ => $sexs[$i],
‘birthday’ => $birthdays[$i],
’email’ => $emails[$i],
‘phone’ => $phones[$i]
);
array_push($list,$arr);
unset($arr);