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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:03:30+00:00 2026-06-02T08:03:30+00:00

I’m completely lost here. I want to send an email with PHP without leaving

  • 0

I’m completely lost here. I want to send an email with PHP without leaving my page. But I can’t figure out how to get the data to the PHP file to email it. And when I do get it there, I would be lost. So any help with what the PHP file should look like would be great too.
Here is the form.

<table id="dialog">
        <tr><td><input type="text" id="name" name="name" placeholder="Your Name" size="20" class="tbow" /></td></tr>
        <tr><td><input type="text" id="email" name="email" placeholder="Your Email" size="20" class="tbow" /></td></tr>
        <tr><td><input type="text" id="number" name="number" placeholder="Your Phone Number" size="20" class="tbow" /></td></tr>
        <tr><td><textarea id="message" name="message" rows="5" cols="25" class="tbow" placeholder="Your Message"></textarea></td></tr>
        <tr><td><input type="button" value="Send!" onclick="senem();" id="sender" /></td></tr>
</table>

And I’ve tried this…

function senem(){
        var name = document.getElementById("name").value;
        var email = document.getElementById("email").value;
        var number = document.getElementById("number").value;
        var message = document.getElementById("message").value;
        $.ajax({
            type: "POST",
            url: "mmaa.php",
            data: "name=" + name + "&email=" + email + "&number=" + number = "&message=" + message,
            success: alert("It works!!!");
        });
 }
  • 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-02T08:03:32+00:00Added an answer on June 2, 2026 at 8:03 am

    Not intended as a copy-and-paste job, but should give you the building blocks to write it yourself:

    Your javascript function;

    function senem() {
        jQuery.ajax({
            type: "POST",
            url: "http://location/of/script.php",
            data: { var1: "foo", var2: "bar" },
        });
    }
    

    and in the php;

    <?php
        $var1 = $_POST['var1'];
        $var2 = $_POST['var2']; //do something interesting with these
    
        $to = "john@example.com";
        $subject = "Wooo Email!";
        $message = "Sorry John, you're fired.";
    
        mail($to, $subject, $message, "From: system@yourdomain.com\r\n");
    ?>
    

    The values of var1 and var2 you will probably want to assign clientside, using jQuery (eg $(“#name”).val(); ) and you will also need to install and configure an SMTP server alongside Apache (use Exim, and find a friendly geek to help you).

    PS: the \r\n is because SMTP shares some syntax with HTTP, it’s not important, but the mail command probably won’t work without them.

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has

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.