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

  • Home
  • SEARCH
  • 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 6936043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:10:58+00:00 2026-05-27T12:10:58+00:00

I have HTML that looks like this: <form id=kinodForm> <input type=text name=element[5] value=krispy kreme

  • 0

I have HTML that looks like this:

<form id="kinodForm">
    <input type="text" name="element[5]" value="krispy kreme" />
    <input type="text" name="element[6]" value="in" />
    <input type="text" name="element[7]" value="n" />
    <input type="text" name="element[8]" value="out" />
    <input type="text" name="element[9]" value="drive" />
</form>

And some javascript that looks like this:

$(document).ready(function(){
    var kinod = $('#kinodForm').serializeArray();
    $.post('test.php', {form: kinod}, function(data){
        console.log(data);
    });
});

The PHP script that the ajax request is bound to is simple:

<?php print_r($_POST); ?>

The result of the post request is being logged to the console. It’s outputting something like this:

[form] => Array ( 
    [0] => Array ( [name] => element[5] [value] => 'krispy kreme' ) 
    [1] => Array ( [name] => element[6] [value] => 'in' ) 
    [2] => Array ( [name] => element[7] [value] => 'n' ) 
    [3] => Array ( [name] => element[8] [value] => 'out' ) 
    [4] => Array ( [name] => element[9] [value] => 'drive' ) 
)

This output isn’t perfect because I want to be able to do this in the PHP script above without regex:

<?php
    $form = $_POST['form'];
    foreach($form as $id => $value){
        echo 'element['.$id.'] -> '.$value.'<br>';
    }
?>

This code will obviously be using the values {0,1,2,3,4} for $id, when I want them to stay the same as defined in the HTML form. {5,6,7,8,9}

I feel like I shouldn’t have to parse the html array id. Suggestions?

  • 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-27T12:10:58+00:00Added an answer on May 27, 2026 at 12:10 pm

    Try this:

    $.post('test.php', kinod, function(data){
        console.log(data);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an html form that looks like this: <form name=form_ method=post id=contactUs action=myPage.aspx
I have some HTML that looks like this: <div> <div class=value> <a href=# class=clicker>Some
If I have some HTML that looks like this: <div id=text> This is some
For instance, I want to have a html form that looks like this: <table>
We have some html that looks like this: <form id=MyUserControl runat=server method=post> <script language=javascript
I have a form that I want to validate looks like this: <!DOCTYPE html
I have a webpage that looks like: <html> <head> <title>Hi</title> </head> <body> <form name=mainForm
I have html in my form that looks like this. First, is this code
I have some HTML that looks like this: <ul class=faq> <li class=open> <a class=question
I have html code that looks roughly like this: <div id=id1> <div id=id2> <p>some

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.