Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8327417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:06:05+00:00 2026-06-09T01:06:05+00:00

<!doctype html> <html> <head> <title>jQuery Tagit Demo Page (HTML)</title> <script src=demo/js/jquery.1.7.2.min.js></script> <script src=demo/js/jquery-ui.1.8.20.min.js></script> <script

  • 0
<!doctype html>
<html>
<head>
  <title>jQuery Tagit Demo Page (HTML)</title>
  <script src="demo/js/jquery.1.7.2.min.js"></script>
  <script src="demo/js/jquery-ui.1.8.20.min.js"></script>
  <script src="js/tagit.js"></script>


  <link rel="stylesheet" type="text/css" href="css/tagit-stylish-yellow.css">

  <script>


    $(document).ready(function () {


    var list = new Array();
    var availableTags = [];

     $('#demo2').tagit({tagSource:availableTags});


     $('#demo2GetTags').click(function () {
        showTags($('#demo2').tagit('tags'))
      });

     /*
    $('li[data-value]').each(function(){
        alert($(this).data("value"));
    });*/

    $('#demo2').click(function(){
        $.ajax({
            url: "demo3.php",
            type: "POST",
            data: { items:list.join("::") },
            success: alert("OK")
        });
    });

    function showTags(tags) {


        console.log(tags);
        var string = "";
        for (var i in tags){
          string += tags[i].value+" ";
         }
          var list = string.split(" ");
          //The last element of the array contains " "
          list.pop();   
        }
    });
  </script>
</head>
<body>

<div id="wrap">
    <?php 

        $lis = $_POST['items'];
        $liarray = explode("::", $lis);
        print_r($liarray);

    ?>
<div class="box">
  <div class="note">
    You can manually specify tags in your markup by adding <em>list items</em> to the unordered list!
  </div>

    <ul id="demo2" data-name="demo2">
        <li data-value="here">here</li>
        <li data-value="are">are</li>
        <li data-value="some...">some</li>
        <!-- notice that this tag is setting a different value :) -->
        <li data-value="initial">initial</li>
        <li data-value="tags">tags</li>
    </ul>

  <div class="buttons">
    <button id="demo2GetTags" value="Get Tags">Get Tags</button>
    <button id="demo2ResetTags" value="Reset Tags">Reset Tags</button>
    <button id="view-tags">View Tags on the console </button>
  </div>
</div>

</div>
<script>
</script>
</body>
</html>

This code will just transfer the list of items in the dostuff.php but when I try to print_r it on PHP nothing won’t come out. why is that?

I am doing an ajax request on this line

$('#demo2').click(function(){
            $.ajax({
                url: "demo3.php",
                type: "POST",
                data: { items:list.join("::") },
                success: alert("OK")
            });
        });

and the code in PHP

<?php 

        $lis = $_POST['items'];
        $liarray = explode("::", $lis);
        print_r($liarray);

    ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:06:08+00:00Added an answer on June 9, 2026 at 1:06 am

    This is just a shot in the dark, given the limited information, but it would appear that you’re expecting something to happen with the data sent back from the server.. but you literally do nothing with it. On success, you have it display an alert… and nothing else.

    Try changing your success entry to the following:

    success: function(data) {
        $("#wrap").html(data);
    }
    

    This will fill the div with the data from the POST request. The reason it shows up as nothing as it is…, you aren’t loading the currently executing page with the data needed for the print_r to actually echo anything.

    Edit: How to insert values into database;

    Database interaction now-a-days is done with either custom wrappers, or the php Data Object, also referred to as PDO, as opposed to the deprecated mysql_* functions.

    First, you prepare your database object, similar to how a connection is done in the aforementioned deprecated functions:

    $dbh = new PDO("mysql:host=hostname;dbname=database", $username, $password);
    

    Then, you can begin interaction, preparing a query statement..

    $stmt = $dbh->prepare("UPDATE table_name SET column1 = :column1 WHERE id = :id");
    

    Binding a parameter in said statement..

    $stmt->bindParam(':column1', $column1);
    $stmt->bindParam(':id', $id);
    $id = $_POST['id'];
    

    And finally executing the query:

    try {
        $stmt->execute();
    }
    catch (Exception $e) {
        echo $e;
    }
    

    PDO auto-escapes any strings bound in the prior statements, making it save from SQL-injection attacks, and it speeds up the process of multiple executions. Take the following example:

    foreach ($_POST as $id) {
        $stmt->execute();
    }
    

    Since the id parameter is already bound to $id, all you have to do is change $id and execute the query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<!doctype html> <html> <head> <title>jQuery Tagit Demo Page (HTML)</title> <script src=demo/js/jquery.1.7.2.min.js></script> <script src=demo/js/jquery-ui.1.8.20.min.js></script> <script
<!DOCTYPE html> <html> <head> <title></title> <script src=assets/js/jquery.js type=text/javascript></script> <script src=assets/js/jquery.validate.min.js type=text/javascript></script> <script type=text/javascript> $(document).ready(function()
<!DOCTYPE html> <html> <head> <link rel=stylesheet type=text/css href=styles/common.css> <script src=http://code.jquery.com/jquery-latest.min.js></script> <script type='text/javascript'> $(function() {
I have a layout page thusly <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <script src=@Url.Content(~/Scripts/jquery-1.7.1.min.js) type=text/javascript></script>
See example: <!DOCTYPE html> <html> <head> <title>language</title> <script type=text/javascript src=http://www.google.com/jsapi> </script> </head> <body> <div
<!DOCTYPE HTML> <html lang=en-US> <head> <meta charset=UTF-8> <title></title> <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js></script> <script type=text/javascript> $(function(){
my code is: <!DOCTYPE html> <html> <head> <title>Demo</title> <meta charset=utf-8/> <script src=https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js type=text/javascript></script> <script
my code is: <!DOCTYPE html> <html> <head> <title>Demo</title> <meta http-equiv=Content-Type content=text/html; charset=utf-8 /> <script
<!DOCTYPE html> <html> <head> <title>Site :: </title> <link rel=stylesheet media=screen href=css/wicahost.css /> <link rel=stylesheet
my code http://jsfiddle.net/4Ub95/ <!DOCTYPE html> <html> <head> <title>example</title> </head> <body> <script src=libs/jquery-1.7.2.js></script> <script> $(function(){

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.