从标记区域获取值(类似于stackoverflow)并将其保存在数据库中

With help of code in github i was able to create an input area like this

enter image description here

I wish to take the values from the i/p and save it in the database. For example in this case(img) i would like to store all the values i.e html,php,java,jquery in database

Here is part of the code

 <script>
    $(function(){
        $('#myTags').tagit();
    });
</script>

</head>
<body>
    <form class="form-horizontal" role="form" action="c_tag.php" method="post">
        <ul id="myTags"></ul>
        <input type="hidden" class="form-control" name="tags">
        <button type="submit" value="submit" name="submit"> Submit <i class="fa fa-arrow-right"></i></button>
    </form>
</body>

code on c_tag.php page

$tag = mysqli_real_escape_string($con, $_POST['tags']);
$sql= "INSERT INTO usertags (tag) VALUES ('$tag')";
if(!mysqli_query($con,$sql)) {
    echo "Error: " . $sql . "<br>" . mysqli_error($con);
}

Issue is that when i get redirected to tags.php page, i am not getting value inside $tag

You can set value to input on availableTags event. Try this:-

 $("#myTags").tagit({
    availableTags: sampleTags,
    afterTagAdded:function(){      
      $('[name="tags"]').val($("#myTags").tagit("assignedTags"));          
    }
});

Demo