First of all i am beginner to php. here is the table structure of table "post"
<form method="post" action="postStatus.php">
<textarea rows="3" name="con" id="con" placeholder="what do you think?"></textarea><br>
<input type="file" accept="image/*" name="img" id="img>
<button name="post" id="post"> Post > </button>
</form>
postStatus.php
<?php
session_start();
require_once '../log/class.user.php';
$user_home = new USER();
if(!$user_home->is_logged_in())
{
$user_home->redirect('../log/index.php');
}
$stmt = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
$stmt->execute(array(":uid"=>$_SESSION['userSession']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$userid = $row['userID'];
$postid = microtime();
$con = $_POST['con'];
($GLOBALS["___mysqli_ston"] = mysqli_connect("localhost", "root", ""));
mysqli_select_db($GLOBALS["___mysqli_ston"], vaistra);
if(isset($_POST['post']))
{
mysqli_query($GLOBALS["___mysqli_ston"], "INSERT INTO post (`postId`, `userId`, `content`, `timeStamp`) VALUES ('$postid', '$userid', '$con', CURRENT_TIMESTAMP);");
}
header('Location: user_wall.php');
?>
i have to insert submit data to this table using this form. one input field for content column and file upload file upload in directory and path must be stored in database according to file type. like if uploaded file is a video then path must be stored in video column. postId and userId field is auto generated .
thanks in advance.