2012-09-13 44 views
3

我製作了一個包含6個圖像的26個字段的表單。使用PHP語言,我使用輸入類型提交提交表單,然後發佈所有值,但是沒有完成數據庫中的輸入。php表單不提交數據庫中的值

它顯示了這個錯誤:G:\xampp\tmp\php9506.tmp

差錯,用PHP編寫的,9506數量是隨機數,但每一次我嘗試提交表單變化。

我的數據庫和連接文件是正確的。

可能的原因是什麼?

<?php 
include "header.php"; 
include "left.php"; 

$busi_cat = $_GET['mcatname']; 



if(isset($_POST) && $_POST['add'] == "Add") 
{ 


extract($_POST); 

$adver_type = implode(',',$adver_type); 
echo $busi_cat = $_GET['mcatname']; 

if ($_FILES["photo1"]['tmp_name'] != "") 
    { 
     if(! file_exists("images/client")) 
     { 
     mkdir("images/client"); 
     } 
     echo $source = $_FILES["photo1"]['tmp_name']; 
     $photo1 = "images/client/".$_FILES["photo1"]['name']; 

     if(move_uploaded_file($source, $photo1)) 
     { 
      echo "image uploaded succesfully"; 
     } 
     else 
     { 
      echo "problem in uploading";  
     } 
    } 
    else 
    { 
     echo "please select a photo"; 
    } 

    if ($_FILES["photo2"]['tmp_name'] != "") 
    { 
     if(! file_exists("images/client")) 
     { 
     mkdir("images/client"); 
     } 

     $source = $_FILES["photo2"]['tmp_name']; 
     $photo2 = "images/client/".$_FILES["photo2"]['name']; 

     if(move_uploaded_file($source, $photo2)) 
     { 
      echo "image uploaded succesfully"; 
     } 
     else 
     { 
      echo "problem in uploading";  
     } 
    } 
    else 
    { 
     echo "please select a photo"; 
    } 

    if ($_FILES["photo3"]['tmp_name'] != "") 
    { 
     if(! file_exists("images/client")) 
     { 
     mkdir("images/client"); 
     } 

     $source = $_FILES["photo3"]['tmp_name']; 
     $photo3 = "images/client/".$_FILES["photo3"]['name']; 

     if(move_uploaded_file($source, $photo3)) 
     { 
      echo "image uploaded succesfully"; 
     } 
     else 
     { 
      echo "problem in uploading";  
     } 
    } 
    else 
    { 
     echo "please select a photo"; 
    } 

    if ($_FILES["photo4"]['tmp_name'] != "") 
    { 
     if(! file_exists("images/client")) 
     { 
     mkdir("images/client"); 
     } 

     $source = $_FILES["photo4"]['tmp_name']; 
     $photo4 = "images/client/".$_FILES["photo4"]['name']; 

     if(move_uploaded_file($source, $photo4)) 
     { 
      echo "image uploaded succesfully"; 
     } 
     else 
     { 
      echo "problem in uploading";  
     } 
    } 
    else 
    { 
     echo "please select a photo"; 
    } 

    if ($_FILES["photo5"]['tmp_name'] != "") 
    { 
     if(! file_exists("images/client")) 
     { 
     mkdir("images/client"); 
     } 

     $source = $_FILES["photo5"]['tmp_name']; 
     $photo5 = "images/client/".$_FILES["photo5"]['name']; 

     if(move_uploaded_file($source, $photo5)) 
     { 
      echo "image uploaded succesfully"; 
     } 
     else 
     { 
      echo "problem in uploading";  
     } 
    } 
    else 
    { 
     echo "please select a photo"; 
    } 

    if ($_FILES["photo6"]['tmp_name'] != "") 
    { 
     if(! file_exists("images/client")) 
     { 
     mkdir("images/client"); 
     } 

     $source = $_FILES["photo6"]['tmp_name']; 
     $photo6 = "images/client/".$_FILES["photo6"]['name']; 

     if(move_uploaded_file($source, $photo6)) 
     { 
      echo "image uploaded succesfully"; 
     } 
     else 
     { 
      echo "problem in uploading";  
     } 
    } 
    else 
    { 
     echo "please select a photo"; 
    } 




echo $query = "INSERT INTO register(busi_name, busi_cat, busi_scat, oth_busi_cat, addr, cont_per, phone, mobile, emailid, website, deal, keyword, message, adver_plan, photo1, photo2, photo3, photo4, photo5, photo6, status, full_page)VALUES('$busi_name', '$busi_cat', '$busi_scat', '$oth_busi_cat', '$addr', '$cont_per', '$phone', '$mobile', '$emailid', '$website', '$deal', '$keyword', '$message','$adver_type','$photo1','$photo2','$photo3','$photo4','$photo5','$photo6','0', '0')"; 
$res = mysql_query($query); 
if($res) 
    { 
     $msg = "Your Business Added Successfully."; 
    } 
    } 
    ?> 
+4

顯示一些代碼... –

+2

我想這是你毛衣的顏色,試着改變它,然後告訴我們! – moonwave99

+0

php提交代碼?它非常冗長。 –

回答

1

可能是您使用$_GET而不是$_POST。 嘗試$_POST['element name']

我覺得問題是在extract函數。

+0

即時使用$ _POST –

+1

建議'$ _REQUEST'會更好(可以),但無論哪種方式,這是一個評論比答案更多,我知道你很想幫忙,但這裏的人是非常嚴格的*非答案*答案,如果這是有道理的。 – Fluffeh

+0

只是告訴我們的代碼.. –

0

echo $query = "INSERT I....

從該行中刪除echo。這是您看到「隨機數」時打印的內容。

如果要打印查詢(不推薦),請在之後加echo $query;$query = "INSERT一行。請使用mysqliprepared statements

+0

這是什麼mysqli –

+0

PHP的下一個版本的MySQL庫。見http://us.php.net/manual/en/book.mysqli.php –