jquery - Submit form data and upload using Ajax and php? -


first of beginner php. here table structure of table "post"

enter image description here

<form method="post" action="poststatus.php">   <textarea rows="3" name="con" id="con" placeholder="what 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 * tbl_users 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 post (`postid`, `userid`, `content`, `timestamp`) values ('$postid', '$userid', '$con', current_timestamp);");  }  header('location: user_wall.php');  ?>  

i have insert submit data table using form. 1 input field content column , file upload file upload in directory , path must stored in database according file type. if uploaded file video path must stored in video column. postid , userid field auto generated .

thanks in advance.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -