Я пытаюсь работать с администратором. Я загрузил этот пример дизайна панели администратора: 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 ..
Примечание. Неопределенный индекс: bilgi in ..
note: 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.") "); } } ?>
.<?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.") "); } ?>
.<?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.") "); } ?>