0

私は管理パネルの作業を試みています。この例の管理パネル デザインをダウンロードしました: http://medialoot.com/item/html5-admin-template/

HTML 構造: http://pastebin.ubuntu.com/5940949/

PHPコードを試してみましたが、

<?php
if(isset($_GET['submit'])){
    if($_FILES["carImage"]["error"] > 0){
    echo '<script type="text/javascript">alert('."File not upload" . $_FILES["carImage"]["error"].');</script>';
    }else{
        if(!is_dir("../inc/imj/cars")){
            mkdir("../inc/imj/cars");
        }
        $carImage_ = "../inc/imj/cars".$_FILES["carImage"]["name"];
        move_uploaded_file($_FILES["carImage"]["tmp_name"],$carImage_);

        mysql_query("

        INSERT INTO contents ('indexId','catId','carModelName','carCash','carImage','carAlt','carTitle','carKMH','carWeight','carWheelInch','carColur','info')
        VALUES (NULL,'".$_GET['catId']."','".$_GET['carModelName']."','".$_GET['carCash']."','".$carImage_."','".$_GET['carAlt']."','".$_GET['carTitle']."','".$_GET['carKMH']."','".$_GET['carWeight']."','".$_GET['carWheelInch']."','".$_GET['carColur']."','".$_GET['info']."')

        ");

    }
}       
?>

別のクエリコードを試しましたが、

mysql_query("

INSERT INTO contents ('indexId','catId','carModelName','carCash','carImage','carAlt','carTitle','carKMH','carWeight','carWheelInch','carColur','info')
VALUES (NULL,".$_GET['catId'].",".$_GET['carModelName'].",".$_GET['carCash'].",".$carImage_.",".$_GET['carAlt'].",".$_GET['carTitle'].",".$_GET['carKMH'].",".$_GET['carWeight'].",".$_GET['carWheelInch'].",".$_GET['carColur'].",".$_GET['info'].")

");

ファイルがアップロードされていないと思います。動作していません。

エラーのため;

注意: 未定義のインデックス: carImage in ..

Notice: 未定義のインデックス: bilgi in ..

注: TABLE contents.indexId は主キーで、自動インクリメントです。

私たちはどのように解決しますか?

ご関心をお寄せいただきありがとうございます。

アップデート

画像のアップロードの問題は;

<?php
$catId = isset($_GET['catId']) ? $_GET['catId'] : "";
$carModelName = isset($_GET['carModelName']) ? $_GET['carModelName'] : "";
$carCash = isset($_GET['carCash']) ? $_GET['carCash'] : "";
$carAlt = isset($_GET['carAlt']) ? $_GET['carAlt'] : "";
$carTitle = isset($_GET['carTitle']) ? $_GET['carTitle'] : "";
$carKMH = isset($_GET['carKMH']) ? $_GET['carKMH'] : "";
$carWeight = isset($_GET['carWeight']) ? $_GET['carWeight'] : "";
$carWheelInch = isset($_GET['carWheelInch']) ? $_GET['carWheelInch'] : "";
$carColur = isset($_GET['carColur']) ? $_GET['carColur'] : "";
$info = isset($_GET['info']) ? $_GET['info'] : "";
if(isset($_GET['submit'])){
    if($_FILES["carImage"]["error"] > 0){
    echo '<script type="text/javascript">alert('."File not upload" . $_FILES["carImage"]["error"].');</script>';
    }else{

        $carUrl_ = "../inc/imj/urun";
        if(!is_dir($carUrl_)){mkdir($carUrl_);}

        $carImage_ = $carUrl_.$_FILES["carImage"]["name"];
        $carUrlName = $_FILES["carImage"]["name"];
        move_uploaded_file($_FILES["carImage"]["tmp_name"],$carImage_);

        mysql_query("

        INSERT INTO contents ('indexId','catId','carModelName','carCash','carImage','carAlt','carTitle','carKMH','carWeight','carWheelInch','carColur','info')
        VALUES (".$catId.",".$_GET['carModelName'].",".$_GET['carCash'].",".$carUrlName.",".$carAlt.",".$carTitle.",".$carKMH.",".$carWeight.",".$carWheelInch.",".$carColur.",".$info.")

        ");

    }
}       
?>

更新 2

<?php
$catId = isset($_GET['catId']) ? $_GET['catId'] : "";
$carModelName = isset($_GET['carModelName']) ? $_GET['carModelName'] : "";
$carCash = isset($_GET['carCash']) ? $_GET['carCash'] : "";
$carAlt = isset($_GET['carAlt']) ? $_GET['carAlt'] : "";
$carTitle = isset($_GET['carTitle']) ? $_GET['carTitle'] : "";
$carKMH = isset($_GET['carKMH']) ? $_GET['carKMH'] : "";
$carWeight = isset($_GET['carWeight']) ? $_GET['carWeight'] : "";
$carWheelInch = isset($_GET['carWheelInch']) ? $_GET['carWheelInch'] : "";
$carColur = isset($_GET['carColur']) ? $_GET['carColur'] : "";
$info = isset($_GET['info']) ? $_GET['info'] : "";
if(isset($_GET['submit'])){

        mysql_query("

        INSERT INTO contents ('indexId','catId','carModelName','carCash','carImage','carAlt','carTitle','carKMH','carWeight','carWheelInch','carColur','info')
        VALUES (".$catId.",".$_GET['carModelName'].",".$_GET['carCash'].",tryImg.png,".$carAlt.",".$carTitle.",".$carKMH.",".$carWeight.",".$carWheelInch.",".$carColur.",".$info.")

        ");

}       
?>
4

1 に答える 1