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 1088893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:08:17+00:00 2026-05-16T23:08:17+00:00

since I am learning on how to use serialize, I am facing a hiccup

  • 0

since I am learning on how to use serialize, I am facing a hiccup where after I used the below code which is the Jquery post

jQuery.post("d_in.php",jQuery("#myform").serialize(), function(data){
   alert("Data Loaded: " + data); 

and let’s say I have 2 inputs which names are Small$item_id, where each input name follows the items itself,

whenever I try

echo $_POST['Small'.$item_id] I get both in one

let’s say 1 for small102-s and 3 for small1055-a

when I print the result I get as follows : 13

even when it comes to more items

how can I split the number?

Update #1:

i tried using explode("&", $_POST['Small'.$item_id] i am getting null, it seems the data is sent without the & it is sent together without any split.

Update#2:
here is whats in d_in.php

foreach ($cart->get_contents() as $item)
        {
        $item_id    = $item['id'];
        $item_name  = $item['name'];
        $item_price = $item['price'];
        $item_qty   = $item['qty'];
        $item_ids = explode("-",$item_id);

        for($i = 0; $i < count($item_ids); $i++){

                                                $item_idn = join("",$item_ids);

                                                }



echo $_POST['Small'.$item_idn];
$item_idn = "";
        }
  • 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-05-16T23:08:17+00:00Added an answer on May 16, 2026 at 11:08 pm

    Working fine for me

    <form id="test" method="post">
    <input type="text" name="small102-s" id="small102-s" />
    <input type="text" name="small1055-a" id="small1055-a" />
    <input id="testbtn"  type="button" />
    </form>
    $(document).ready(function() {
    
    $("#testbtn").click(function()
    {
    var dataval=$("#test").serialize();
    alert(dataval);
        $.post("1.php",dataval, function(data)
        {
         alert("Data Loaded: " + data); 
         });
     });
    

    });

    On the 1.php

    <?php
    echo $_POST['small102-s'];
    ?>
    

    Check Live Here

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

Sidebar

Related Questions

I'm learning to use vlad the deployer and I've got a question. Since I'm
I'm learning to use the Glassfish 3 REST interface directly, since the admin web
OK, so I am learning to use UIScrollView in interface builder. since the scrollView
Since I started learning F# and OCaml last year, I've read a huge number
Looking at learning some C since i saw in another SO question that is
I've been using Winforms since .NET 1.1 and I want to start learning WPF.
I spent ages learning VML and creating charts for a website once, but since
Here is a problem I've struggled with ever since I first started learning object-oriented
I'm learning to use the NSXMLParser API for the iOS platform and so far
Hi I'm currently learning Python since the syntax feels so succinct and the idioms

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.