Zdravím
Dělám formulář pro přidávání příspěvků, ale když dám odeslat, tak se mi odešlou pouze titulek, datum a obrázek, které se mi v databázi na localhostu obejví. Zbytek ikdyž je zadaný jako bych ho nezadal. Nějaké řešní? díky
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>APK Market</title>
<link rel="stylesheet" type="text/css" href="../style/style.css">
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet" media="screen">
<script src="../bootstrap/js/bootstrap.min.js"></script>
<script src="../bootstrap/js/bootstrap.js"></script>
</head>
<body>
<form method="post" action="insert_post.php" enctype="multipart/form-data">
<div class="new_post">
<div class="headtitle">Insert new post</div>
<div class="new_title">
<p>New title</p>
<input type="text" name="title">
</div>
<div class="new_author">
<p>Author</p>
<input type="text" name="author">
</div>
<div class="new_keywords">
<p>Keywords</p>
<input type="text" name="keywords">
</div>
<div class="new_image">
<p>Image</p>
<input type="file" name="image">
</div>
<div class="new_content">
<textarea name="content" cols="20" rows="8"></textarea>
</div>
<div class="submit">
<input type="submit" name="submit" value="OK">
</div>
</div>
</form>
<script src="https://code.jquery.com/jquery.js"></script>
<script src="../bootstrap/js/bootstrap.js"></script>
</body>
</html>
<?php
include("../includes/connect.php");
if(isset($_POST['submit']))
{
echo $post_date = date('y-m-d');
echo $post_title = $_POST['title'];
echo $post_author = $_POST['author'];
echo $post_keywords = $_POST['keywords'];
echo $post_image = $_FILES['image']['name'];
echo $image_tmp = $_FILES['image']['tmp_name'];
echo $post_content = $_POST['content'];
if($post_title=="" or $post_author="" or $post_keywords="" or $post_content="")
{
echo"<script>alert('any field is empty')</script>";
exit();
}
else
move_uploaded_file($image_tmp,"../uploaded_images/$post_image");
$insert_query = "insert into posts (post_title,post_date,post_author,post_image,post_keywords,post_content) values ('$post_title','$post_date','$post_author','$post_image','$post_keywords','$post_content')";
if(mysql_query($insert_query))
{
echo "<center><h1>Post published seccesfuly!</h1></center>";
}
}
?>