if(isset($_POST['topic_poster']) && isset($_POST['topic_post']) && isset($_POST['topic_rel']) && isset($_FILES['topic_photo'])) { //this doesnt work since it cant check the uploaded file correctly
$target_dir = 'images/';
$target_file = $target_dir . basename($_FILES['topic_photo']['name']);
move_uploaded_file($_FILES['topic_photo']['tmp_name'], $target_file);
$poster = $_POST['topic_poster'];
$post = $_POST['topic_post'];
$relation = $_POST['topic_rel'];
$photo = $_FILES['topic_photo']['name'];
$sql = "INSERT INTO topics ('topic_poster', 'topic_post', 'topic_rel', 'topic_photo') VALUES ('$poster', '$post', '$relation', '$photo')";