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

The Archive Base Latest Questions

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

//Jquery code to send the data with AJAX $.ajax({ type: POST, url: test.php, data:

  • 0

//Jquery code to send the data with AJAX

        $.ajax({
            type: "POST",
            url: "test.php",
            data:
            "fname="+ fname +
            "& lname="+ lname +
            "& address="+ address +
            "& city="+ city +
            "& state="+ state +
            "& zip="+ zip +
            "& phone="+ phone +
            "& useremail="+ useremail +
            //the following values are not being receieved by the php correctly
            "& subtotal="+ subTotal +
            "& quantity="+ quantity,
            success: function(){
            $('#oderBtn').hide(function({$('#orderTest').fadeOut();});
            }
        });

//PHP CODE TO RECEIVE THE AJAX DATA

$fname = htmlspecialchars(trim($_POST['fname']));
$lname = htmlspecialchars(trim($_POST['lname']));
$city = htmlspecialchars(trim($_POST['city']));
$state = htmlspecialchars(trim($_POST['state']));
$zip = htmlspecialchars(trim($_POST['zip']));
$address = htmlspecialchars(trim($_POST['address']));
$email = htmlspecialchars(trim($_POST['useremail']));

//these do not post correctly, i do not know why
$subTotal = htmlspecialchars(trim($_POST['subtotal']));
$quantity = htmlspecialchars(trim($_POST['quantity']));

So the problem is that fname, lname, city, state, zip, address, and email are all working but subtotal, and quantity are not working, firebug has them all POSTing in the same way, it seems like the PHP is just not recieving the data properly.

Adding echo file_get_contents(“php://input”); to the php does get everything sent echoed back, including subtotal and quantity but just doing $_POST[‘subtotal’] will not get the value.

Thanks for any assistance in this matter.

  • 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-09T05:09:16+00:00Added an answer on June 9, 2026 at 5:09 am

    Well, first, you don’t need to build a string like that. You can simply pass an object literal:

        $.ajax({
            type: "POST",
            url: "test.php",
            data: {
                fname: fname,
                lname: lname
                ...
            },
            success: function(){
            $('#oderBtn').hide(function({$('#orderTest').fadeOut();});
            }
        });
    

    And jQuery will serialize it as necessary. I think it’s impressive that it’s honoring your POST request at all since you’re passing it a query string.

    Also, it looks suspicious that it stops working after the email. can you paste the result of print_r($_POST); in PHP?

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

Sidebar

Related Questions

I have the following code: jQuery.ajax({ type: POST, async: true, url: '/index/city', data: {massiv:
jQuery code: function ajaxsubmit(){ $.ajax({ url: /update, type: POST, dataType: html }).success(function(data) { $('#result').html(data);
i have this code for sending data var test={imagename:apple.jpg,x:13,y:33}; $.ajax({ type: POST, url: some.php,
using jquery's .post i send do my php code an object that with var_dump
I'm attempting to send a piece of data through jQuery .ajax() to a PHP
I have an issue I have this jQuery code: $(document).ready(function(){ $(#follow).click(function(){ $.ajax({ type: 'POST',
Issue I have an aspx page with jQuery code to send an ajax request
I have this code just to send data from already loaded jqGrid: jQuery(#bedata).click(function(){ //Function
I wrote a jquery code to send values to a php file $('#def_formSubmit').live("click",function(){ var
I have jquery code output json data and I need to send this data

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.