2014-03-30 21 views
0

對不起,如果我的問題不是現場,但是當我提交我的表單時,沒有行動發生,甚至沒有錯誤 出現,我不知道爲什麼所以請你幫助我!當我提交表單沒有發生行動

這裏我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')"; 
     [email protected]_query ($dbc,$result2) or die(mysql_error()); 
     if ($result) 
     { 
     header("Location:project.php"); 
     } 
     else 
     { 
     echo "error"; 
     } 
} 
} 
else 
{ echo" <script> 
    alert('try again'); 
      </script> 
    "; 
}  
} 

?> 

注:

在我的數據庫

我有2臺一個叫​​和另一個名爲project 和專案是在計劃表

外鍵
+0

你最好張貼您的HTML代碼在這裏,並嘗試使用error_reporting(E_ALL)顯示錯誤; ini_set(「display_errors」,1); – iwcoder

回答

0

之前if語句你在哪裏檢查是提交d是設置好的把這個代碼,看看收到什麼

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

當我把這個代碼的輸出是陣列 ( ) – Abeer

+0

所以你不發送任何POST數據,你有

?? – przeqpiciel

+0

你是說method =「post」 – Abeer

相關問題