3

我制作了一个包含 26 个字段的表单,其中包括 6 个图像。使用 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 回答 2

1

可能是您使用$_GET而不是$_POST. 尝试$_POST['element name']

我认为问题在于提取功能。

于 2012-09-13T11:45:38.160 回答
0

echo $query = "INSERT I....

echo从此行中删除。这是您看到“随机数”时打印的内容。

如果要打印查询(不推荐),请在行echo $query; $query = "INSERT添加。

另外,请使用mysqli准备好的语句

于 2012-09-13T12:25:26.587 回答