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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:19:28+00:00 2026-06-18T15:19:28+00:00

I have a form that is using php to email myself with enquiries. I

  • 0

I have a form that is using php to email myself with enquiries. I have some jquery that is filling in details into a div,

How can I pass the Jquery var to PHP via ajax? (I’ve read that that is the best way?)

Here’s how’s it’s emailing me with php:

<? if(isset($_POST['submit'])) { 

$to = "rob@domain.com";
$header = 'From: rob@domain.com';
$subject = "Quotation";
$enquiry_first_name = $_POST['enquiryfirstname'];
$enquiry_last_name = $_POST['enquirylastname'];
$enquiry_title = $_POST['enquirytitle'];
$enquiry_organisation = $_POST['enquiryorganisation'];
$enquiry_address = $_POST['enquiryaddress'];
$enquiry_country = $_POST['enquirycountry'];
$enquiry_email_address = $_POST['enquiryemailaddress'];
$enquiry_telephone = $_POST['enquirytelephone'];
$enquiry_additional_comments = $_POST['enquiryadditionalcomments'];

$body = "You have an quote request from the website:

Name: $enquiry_title $enquiry_first_name $enquiry_last_name 
Type of organisation: $enquiry_organisation 
Address: $enquiry_address, $enquiry_country
E-Mail: $enquiry_email_address 
Tel: $enquiry_telephone
Comments: $enquiry_additional_comments

Kind regards";

mail($to, $subject, $body, $header);

echo "Thank you for your enquiry.";

} ?>

Here’s the jquery that is outputting data into a div:

function makeSummary() {
    var summary = [];
    $steps.not(":last").each(function (i, step) {
        $step = $(step);
        summary.push('<p><b>' + $step.data('name') + '</b></p>');
        var $ch = $step.find('input[type="checkbox"]:checked');
        if (!$ch.length) {
            summary.push('<p>No items selected</p>');
        } else {
            $ch.each(function (i, ch) {
                summary.push('<p>' + $(ch).val() + '</p>');
            });
        }
    });
    return summary.join('');
}
  • 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-18T15:19:29+00:00Added an answer on June 18, 2026 at 3:19 pm

    1) Make a hidden input field.
    2) Pass the jQuery var content to the hidden input field

    $('.selector').change(function(){
        //replace the value here.
    });
    

    3) Get it in php with $_POST[‘hiddenname’]

    E: Here is an example: http://jsfiddle.net/yLuNu/4/

    It’s using a dropdown to store a value in a hidden field. You can use any output and store it inside of the hidden field.

    E2: Since I didn’t really get what you want to pass to the hiddenfield: If you have a function and only want the output to save inside the hiddenfield:

    What exactly do you want to pass to your script? I saw a checkbox so I thought you wanna use the change func. In case you only want to return the output of a function

    $('input#hiddenfield').val($VAR)
    

    while var is the output of your function. Just add this at the end of your existing func..

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

Sidebar

Related Questions

I have a PHP contact form that I'm using with jQuery's AJAX method, but
I have a contact form that I'm writing using jQuery and PHP. Below is
(Using MySQL and PHP) I have a search form that will allow my users
I have a relatively simple question. Will using PHP guarantee that a form is
I have a contact form that can be hidden using .slideToggle() but I want
I have a form on a webpage that I submit using the jquery form
I have a form that validates using jquery. The form's id is contact and
Okay so I have a form that is using PHP to mail to an
I have a form that i am validating using jquery the validation plugin. What
I have a problem when sending a form via email using the PHP Mail

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.