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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:32:29+00:00 2026-05-26T18:32:29+00:00

HTML: <form id=continue action=summary.php method=post> <input type=submit value=Continue > </form> JS/JQuery $(‘#continue’).submit(function(){ var data

  • 0

HTML:

<form id="continue" action="summary.php" method="post">
<input type="submit" value="Continue" >
</form>

JS/JQuery

$('#continue').submit(function(){
    var data = ["jon", "steve"];
    var nameArray = JSON.stringify(data);
    $.post("summary.php", { nameArray: nameArray });
});

PHP

$name = json_decode($_POST["nameArray"]);
print_r($name);

When I click the “Continue” button, I want to be redirected to the summary.php page and list the names. Currently, I get an “Undefined index: nameArray error when the summary.php page is loaded.

I checked firebug and there is no POST. So it looks like nameArray isn’t even being posted either. What’s the solution?

  • 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-26T18:32:29+00:00Added an answer on May 26, 2026 at 6:32 pm

    This is not the correct way of handling data.

    You are posting a page (leaving it) and doing an ajax post within? If you want to stay on the page, you use an ajax post. If you are posting data normally, you use a form post.

    If you want to post the name jon or steve as an array you can use the following html

    <input type="hidden" name="nameArray[]" value="jon" />
    <input type="hidden" name="nameArray[]" value="steve" />
    

    If you want to use ajax, then just dont do it on the submit of a form. You can do it on a submit, but then return false at the end of the function so the page will not be submitted (you will stay on the current page)

    • 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 defined as <form name=writeYourAd id=writeYourAd method=post action=post.php?action=preview onsubmit=return checkContentForm(this);
i have this simple html form: <form action=test/ method=get accept-charset=utf-8> <input type=text name=first value=
i have this simple html form: <form action=test/ method=get accept-charset=utf-8> <input type=text name=first value=
If a website user submits an HTML form with: (1) a post method; (2)
In an HTML form post what are valid characters for creating a multipart boundary?
I am implementing an HTML form with some checkbox input elements, and I want
I have an HTML form - with PHP, I am sending the data of
I have a HTML form, and I have a Controller Action that accepts the
When I create a html form like this: $form = new Zend_Form(); $form->setMethod('post'); $form2->addElement('textarea',
I'm using the jQuery Form plugin to do an 'ajax' submit of my form,

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.