send tags to db not work #153

Closed
fabiosss opened this Issue Mar 4, 2013 · 5 comments

Comments

Projects
None yet
2 participants

fabiosss commented Mar 4, 2013

hi!
I try to sent tags on db but i got

  • $(document).ready(function() { $("#myTags").tagit(); }); </script>

    and < ul id= "myTags">< /ul>

  • Owner

    aehlke commented Mar 4, 2013

    Sorry, seems like your message is incomplete?

    On Mon, Mar 4, 2013 at 12:28 PM, fabiosss notifications@github.com wrote:

    hi!
    I try to sent tags on db but i got

    fabiosss commented Mar 4, 2013

    updated..anyway the default code...but not work on db

    fabiosss commented Mar 4, 2013

    full code:

    <script type="text/javascript"> $(document).ready(function() { $("#myTags").tagit(); }); </script>

    < ul id="myTags">< /ul>
    < textarea id="tagsend" style="display:none" rows="30" cols="30" name="tags">< /textarea>
    < input name="invia" type="submit" class="sendnewsbtn" value="Invia" onclick=" document.getElementById('tagsend').innerHTML = document.getElementById('myTags').innerHTML";>

    on submit.php page
    $taginput = $_POST["tags"];
    $tagarray = explode(",",$taginput);
    for($i=0;$i<count($tagarray);$i++){
    $usetag = mysql_real_escape_string(stripslashes(ltrim(rtrim($tagarray[$i]))));
    if($usetag == "") continue;
    $querytag = "INSERT INTO tags (link_id,tag) VALUES ('$rowid','$usetag')";
    mysql_query($querytag);
    }

    Owner

    aehlke commented Mar 4, 2013

    Look at the singleField example in examples.html to see how to get a single
    field with all the tags. You're accessing the tags wrong, singleField will
    handle it for you.

    On Mon, Mar 4, 2013 at 5:28 PM, fabiosss notifications@github.com wrote:

    full code:
    $(document).ready(function() { $("#myTags").tagit(); });

    < ul id="myTags">< /ul>
    < textarea id="tagsend" style="display:none" rows="30" cols="30"
    name="tags">< /textarea>
    < input name="invia" type="submit" class="sendnewsbtn" value="Invia"
    onclick=" document.getElementById('tagsend').innerHTML =
    document.getElementById('myTags').innerHTML";>

    on submit.php page
    $taginput = $_POST["tags"];
    $tagarray = explode(",",$taginput);
    for($i=0;$i<count($tagarray);$i++){
    $usetag =
    mysql_real_escape_string(stripslashes(ltrim(rtrim($tagarray[$i]))));
    if($usetag == "") continue;
    $querytag = "INSERT INTO tags (link_id,tag) VALUES ('$rowid','$usetag')";
    mysql_query($querytag);
    }


    Reply to this email directly or view it on GitHubhttps://github.com/aehlke/tag-it/issues/153#issuecomment-14410268
    .

    fabiosss commented Mar 4, 2013

    thank you so much, now work perfect!

    fabiosss closed this Mar 4, 2013

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment