php 批量处理post数据

<?php
header("Content-Type:text/html;charset=UTF-8");
include('ini.php');

foreach ($_POST as $key=>$value){
$one[]=$key;
$two[]="'".$value."'";
}

$zd = implode(',',$one);
$z = implode(',',$two);

mysql_query("set names utf8");
$sql="INSERT INTO main (".$zd.") VALUES (".$z.")";

if (!mysql_query($sql,$con)){
  die('Error: ' . mysql_error());
  }

echo "<script>alert('任务已提交!');</script>";
echo "<script>history.go(-1);</script>";
?>

 

posted @ 2015-07-27 15:08  fleam  阅读(800)  评论(0编辑  收藏  举报