php - Value of insert query not posting to data base -


i using following code insert id , value of text box table of mysql database, id auto increment, code not insert value column of table while id inserted, please help.

<div> <?php if (isset($_post['addtag'])) {     $tags_dept = $_post['$tags_dept'];      $query = "insert deptag (tagdep) values ('$tags_dept')";     mysql_query($query); }  ?> <a href="#" onclick="toggle_visibility('addtag1');">add tag department</a> <div id="addtag1" style="display:none;">  <form name="form4" method="post" action="" >  <input type="text" name="tags_dept"  />  <input type="submit" value="add" name="addtag" /> </form>    </div> 

convert first mysql mysqli.

<html> <body>  <?php  $con=mysqli_connect("yourhost","username","password","yourdatabase");  if(mysqli_connect_errno()){  echo "error".mysqli_connect_error(); }  if (isset($_post['addtag'])) {     $tagsdept = $_post['$tagsdept'];     $tagsdept = mysqli_real_escape_string($con,$tagsdept); /* prevent bit of sql injection */      mysqli_query($con,"insert deptag (tagdep) values ('$tagsdept')");  } ?>  <a href="#" onclick="toggle_visibility('addtag1');">add tag department</a> <div id="addtag1" style="display:none;">  <form name="form4" method="post" action="" >  <input type="text" name="tagsdept"  />  <input type="submit" value="add" name="addtag" /> </form> </div>      </body> </html> 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -