php - fetch values from form and save in different rows of a table -
i have form through can enter values , save them in database
code of form is
<script>  $(document).ready(function () {      var sampletags ;      $("#mytags").tagit({         availabletags: sampletags,         aftertagadded:function(){                 $('[name="tags"]').val($("#mytags").tagit("assignedtags"));             //alert( $('[name="tags"]').val());         }     }); });  </script>  <form action="insert.php">  <input name="tags" id="mytags" >   <button class="submit" type="submit" value="submit" >submit</button> </form> code of insert.php page
$tag = $_post['tags']; echo $tag; it gives me o/p looks this
first,second,third i want remove commas above o/p , insert each 1 of them in separate row of table. can please tel how can separate above o/p
you can use explode , using for loop insert in database
$tags = explode(",", $_post['tags']);// convert in array break comma foreach($tags $tag) {     // insert query  } 
Comments
Post a Comment