-5
嗨,我已經建立了一個上傳器,應該上傳一些數據和圖像。我的文件和信息不會上傳(mysqli和PHP)
表單顯示在網頁上,沒有錯誤但不會上傳。
這裏是一個截圖也代碼附加。
http://simplicity-designs.tk/images/Screenshot%20%28104%29.png
<?php
include("includes/connect.php");
if(isset($_POST['submit'])){
$title = $_POST['title'];
$date = date('d-m-y');
$author = $_POST['author'];
$image = $_FILES['image']['name'];
$keywords = $_POST['keywords'];
$content = $_POST['content'];
$image_tmp = $_FILES['image']['tmp_name'];
if($title == '' or $author == '' or $keywords == '' or $content == ''){
echo "
<script>
alert('PLEASE CHECK YOUR FORM IS COMPLETE')
</script>";
exit();
move_uploaded_file($image_tmp, "../images/$image");
}else{
$sqli = "INSERT INTO posts (title, date, author, image, keywords, content) VALUES ('$title', ''$date , '$author', '$image', '$keywords', '$content')";
}};
?>
<!doctype html>
<html>
<head>
<title>Inserting Data</title>
<meta charset="utf-8">
</head>
<body>
<form action="insert_data.php" id="InsertDataForm" method="post" enctype="multipart/form-data">
<table width="600" align="center" border="10">
<tr>
<td align="center" bgcolor="#CC6600" colspan="6"><h1>Insert New Data Here</h1></td>
</tr>
<tr>
<td align="right">Data Title</td>
<td><input style="width:300px;" type="text" name="title"/></td>
</tr>
<tr>
<td align="right">Data Author</td>
<td><input style="width:300px;" type="text" name="author"/></td>
</tr>
<tr>
<td align="right">Data Keywords</td>
<td><input style="width:300px;" type="text" name="keywords"/></td>
</tr>
<tr>
<td align="right">Data Image</td>
<td><input style="width:300px; height:50px;" type="file" name="image"/></td>
</tr>
<tr>
<td align="right">Data Content</td>
<td><textarea style="max-width:300px; max-height:300px;" name="content" cols="48" rows="20"></textarea></td>
</tr>
<tr>
<td align="center" colspan="6"><input style="width:200px; height:50px;
margin:5px 0px;" type="submit" name="submit" value="Insert Data Now"/></td>
</tr>
</table>
</form>
</body>
</html>
連接腳本
<?php
$connect = mysqli_connect("localhost","########","####","#######");
?>
無不良帖子只是幫助PLZ我不想拼寫糾正或消極我需要幫助。
的問候和感謝事先
縮進你的代碼,你必須突出顯示它並按下'CTRL + k'。請這樣做。 – ZekeDroid
(要在棧溢出代碼中按壓空格4次而不是使用製表符) – monxas
*「沒有不良的帖子只是幫助PLZ我不想拼寫糾正或消極的我想要幫助。」* - 反諷不羈。 –