当我提交表格时,不会发生任何动作

时间:2014-03-30 06:45:13

标签: php html forms

抱歉,如果我的问题不是场景,但是当我提交表格时,没有任何动作发生,甚至没有错误 出现,我不知道为什么,所以请你能帮助我!!

这是我的php代码

<?php 

if (isset ($_POST["submitted"]))
{
    if (isset($_POST["proName"]))
    {
        $namepro=$_POST["proName"];
    }


  $filename=  $_FILES["imgfile"]["name"];
    if ((($_FILES["imgfile"]["type"] == "image/gif")|| ($_FILES["imgfile"]["type"] == "image/jpeg") || ($_FILES["imgfile"]["type"] == "image/png")  ||
     ($_FILES["imgfile"]["type"] == "image/pjpeg")) && ($_FILES["imgfile"]["size"] < 200000))
  {
    if(file_exists($_FILES["imgfile"]["name"]))
    {
      echo "File name exists.";
    }
    else
    {
      move_uploaded_file($_FILES["imgfile"]["tmp_name"],"uploads/$filename");
    }
  }
  else
  {
    echo "invalid file.";
  }

    if (isset($_POST["selectcat"]))
    {
        $selectpro=$_POST["selectcat"];
    }
    if (isset($_POST["shortDescr"]))
    {
        $desc=$_POST["shortDescr"];
    }
    else
    {$desc=NULL;}

        if (isset($_POST["cost"]))
    {
        $cost=$_POST["cost"];
    }
       else
        {$cost=NULL;}

        if (isset($_POST["product"]))
    {
        $product=$_POST["product"];
    }
    else
    {$product=NULL;}

        if (isset($_POST["marketing"]))
    {
        $mark=$_POST["marketing"];
    }
    else
    {$mark=NULL;}


        if (isset($_POST["power"]))
    {
        $p=$_POST["power"];
    }
    else
    {$p=NULL;}


        if (isset($_POST["risk"]))
    {
        $risk=$_POST["risk"];
    }
    else
    {$risk=NULL;}
        if (isset($_POST["compititiors"]))
    {
        $comp=$_POST["compititiors"];
    }
    else
    {$comp=NULL;}
    $teamWork='';
    if (isset($_POST["team1"]))
    {
        $team=$_POST["team1"];
    }
    if (isset($_POST["s"]))
    {
        $s=$_POST["s"];
        $teamWork=$team."\t\t".$s;

    }

    if (isset($_POST["team2"]))
    {
        $team2=$_POST["team2"];
        $teamWork=$team."\t\t".$s."<br>".$team2;
    }
    else
    {$team2=NULL;}
    if (isset($_POST["s2"]))
    {
        $s2=$_POST["s2"];
        $teamWork=$team."\t\t".$s."<br>".$team2."\t\t".$s2;
    }
    else
    {$s2=NULL;}

    if (isset($_POST["team3"]))
    {
        $team3=$_POST["team3"];
        $teamWork=$team."\t\t".$s."<br>".$team2."\t\t".$s2."<br>".$team3."\t\t";
    }
    else
    {$team3=NULL;}

    if (isset($_POST["s3"]))
    {
        $s3=$_POST["s3"];
        $teamWork=$team."\t\t".$s."<br>".$team2."\t\t".$s2."<br>".$team3."\t\t".$s3;
    }
    else
    {$s3=NULL;}


    $dbc = mysqli_connect("localhost", "root", "", "gettogether");

     $q = "INSERT INTO project (projectname,projecttype,personid,imgProject,status,createDate) VALUES 
     ('$namepro','$selectpro',1,'uploads/$filename','unsubmitted',now())";


      $r = @mysqli_query ($dbc, $q);
        if ($r ) {
    $sql="select projectid from project where personid=1 order by createDate desc";
    $qur=mysql_query($sql) or die(mysql_error());
    if($qur){
   $row=mysql_fetch_array($qur);
   $proID=$row['projectid'];
       $result2 = "INSERT INTO plan (projectid,description,products,marketingplan,financialplan,strenght,risk,team,competitor) VALUES 
      ($proID,'$desc',$product','$mark','$cost','$p','$risk','teamWork','$comp')";
      $result=@mysqli_query ($dbc,$result2) or die(mysql_error());
      if ($result)
      {
      header( "Location:project.php" );
      }
      else
      {
        echo "error";  
      }
 }
 }
 else 
 { echo" <script>
    alert('try again');
            </script>
    ";
 }      
}

?>

注意:

在我的数据库中我有2个表名为plan,另一个名为project 和projectid是计划表中的外键

1 个答案:

答案 0 :(得分:0)

在设置提交检查的if语句之前设置此代码以查看收到的内容

echo '<pre>';
print_r($_POST);
echo '</pre>';