不用二维数组吧,把每个name的[]去掉,打印出来看看

解决方案 »

  1.   

    你这代码不是只有页面和php的一点接收参数处理么?没有关于mysql的处理代码啊
      

  2.   

    郁闷,就是填入分数了,老是显示分数不对。
    现在就是不知道这种写入mysql的语句要怎么写了。
      

  3.   

    提交后,print_r($_POST); 看看,然后对号入座
    你没给出传入数据与表字段的对应关系,人家怎么写代码?
      

  4.   

    第二php写入数据表<?php
    session_start();
    if(isset($_SESSION["name"])){
    echo "欢迎".$_SESSION["name"]."同仁!";
    echo "<a href='../session_unset.php'>注销</a>";
    }else{
    header("Location:../index.html");
    }
    include('../conn.php');
    include('../factory.php');
    $insurance="intent_insurance";
    $jq_field=array("company","car_no","type","coverage","premium");
    if(isset($_POST['add'])){
    $i=count($_POST['jq']);
    $i1=count(array_merge($_POST["sy"],$_POST["sys"]));
    $i2=count(array_merge($_POST["sy"],$_POST["syc"]));
    $i3=count(array_merge($_POST["sy"],$_POST["sysj"]));
    $i4=count(array_merge($_POST["sy"],$_POST["syck"]));
    $i5=count(array_merge($_POST["sy"],$_POST["syd"]));
    $i6=count(array_merge($_POST["sy"],$_POST["syh"]));
    $i7=count(array_merge($_POST["sy"],$_POST["syb"]));
    $i8=count(array_merge($_POST["sy"],$_POST["syz"]));
    $i9=count(array_merge($_POST["sy"],$_POST["syss"]));
    $i10=count(array_merge($_POST["sy"],$_POST["syws"]));
    $i11=count(array_merge($_POST["sy"],$_POST["sybj"]));
    while($i>4 and $i<=5){
    $jq_value=$_POST["jq"];
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."1";
    }
    $i++;
    }
    while($i1>4 and $i1<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["sys"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."2";
    }
    $i1++;
    }
    while($i2>4 and $i2<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["syc"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."3";
    }
    $i2++;
    }
    while($i3>4 and $i3<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["sysj"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."4";
    }
    $i3++;
    }
    while($i4>4 and $i4<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["syck"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."5";
    }
    $i4++;
    }
    while($i5>4 and $i5<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["syd"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."6";
    }
    $i5++;
    }
    while($i6>4 and $i6<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["syh"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."7";
    }
    $i6++;
    }
    while($i7>4 and $i7<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["syb"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."8";
    }
    $i7++;
    }
    while($i8>4 and $i8<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["syz"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."9";
    }
    $i8++;
    }
    while($i9>4 and $i9<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["syss"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."10";
    }
    $i9++;
    }
    while($i10>4 and $i10<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["syws"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."11";
    }
    $i10++;
    }
    while($i11>4 and $i11<=5){
    $jq_value=array_merge($_POST["sy"],$_POST["sybj"]);
    $res=in_tab($jq_field,$jq_value,$insurance);
    if(!$res){
    echo mysql_error()."12";
    }
    $i11++;
    }
    echo '<p>险种数据添加成功!</p>';
    echo '<p><a href="../home.php">返回主页</a></p>';
    echo '<p><a href="intention.php">返回准客户管理</a></p>';
    }
    ?>
    <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <title>网页标题</title>
    <meta name="keywords" content="关键字列表" />
    <meta name="description" content="网页描述" />
    <link rel="stylesheet" type="text/css" href="" />
    <style type="text/css"></style>
    <script type="text/javascript"></script>
    </head>
    <body> </body>
    </html>
      

  5.   

    第三,在写入的时候写了个functionfunction in_tab($field,$value,$table){
    $key=join(',',array_values($field));
    $val="'".join("','", array_values($value))."'";
    $sql="insert {$table} ({$key}) values ({$val})";
    $res=mysql_query($sql);
    if($res){
    return mysql_insert_id();
    }else{
    return false;
    }
    }
    第四数据表结构请老师帮忙优化下代码,主要我还是菜鸟初学