Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send tags to db not work #153

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

send tags to db not work #153

fabiosss opened this issue Mar 4, 2013 · 5 comments

Comments

@fabiosss
Copy link

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>

  • @aehlke
    Copy link
    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
    Copy link
    Author

    fabiosss commented Mar 4, 2013

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

    @fabiosss
    Copy link
    Author

    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);
    }

    @aehlke
    Copy link
    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//issues/153#issuecomment-14410268
    .

    @fabiosss
    Copy link
    Author

    fabiosss commented Mar 4, 2013

    thank you so much, now work perfect!

    @fabiosss fabiosss closed this as completed Mar 4, 2013
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants