How to submit attr value and form values with POST using JQuery and PHP?
<p>So I have a form with an input box and an 3 of a type of <code>div</code> that highlights when clicked. I'm trying to get it to submit the attribute and "#email" value and email it to me via PHP.</p>

<p>Here's my HTML:</p>

<pre><code>&lt;form id="form" name="form" class="custompurchase" action="custom.php" method="post"&gt;
    &lt;input type="email" id="email" name="email" maxlength="40" class="textbox2" placeholder="Email address" required/&gt;
    &lt;a class="customoption storage" onclick="activate(this, 'storage');" data-name="500GB HDD"&gt;
        ...
    &lt;/a&gt;
    &lt;a class="customoption storage" onclick="activate(this, 'storage');" data-name="1TB HDD"&gt;
        ...
    &lt;/a&gt;
    &lt;a class="customoption storage" onclick="activate(this, 'storage');" data-name="2TB HDD"&gt;
        ...
    &lt;/a&gt;
&lt;/form&gt;
</code></pre>

<p>Here's my JQuery:</p>

<pre><code>$(function() {
    var form = $('#form');
    $(form).submit(function(event) {
        event.preventDefault();
        var email = $("#email").val();
        var storage = $(".customoptionactive.storage").attr("data-name");
        $.ajax({
            type: "POST",
            url: $(form).attr("action"),
            data: email, storage
        })
        .done(function(response) {
            ...
        });
    });
});
</code></pre>

<p>And finally my PHP:</p>

<pre><code>&lt;?php
    $emailto = "purchases@prismpc.net";
    $subject = "Custom PC";
    $email = $_POST['email'];
    $storage = $_POST['storage'];
    $entire = "Email: ".$email."\n"."Storage: ".$storage;
    mail($emailto, $subject, $entire);
?&gt;
</code></pre>

<p>However, when I see the email, this is all I get:</p>

<pre><code>Email:
Storage:
</code></pre>

<p>What am I doing wrong? Do I need to set the <code>dataType</code>? Thank you so much for your answers!</p>

<p>Edit: Different from similar question because it was a simple syntax error.</p>