Note that there are some explanatory texts on larger screens.

plurals
  1. POScript not posting input to PHP server script.
    text
    copied!<p>We are implementing a form on our site to let people subscribe their device. We use jquery.easing.js to only show certain fields when others are correct. The javascript is also validating input.</p> <p>Now when it comes to sumbit, we want to sent two fields to our PHP script, so it can send us e-mail with subsciption.</p> <p>The form is working, only we do not receive the email. We have looked into it but can't find a solution. Could someone help us?</p> <p>Javascript (submit part):</p> <pre><code>$('#submit').click(function(e) { e.preventDefault(); var mac=$("#mac").val(); var store=$("#store").val(); //alert(mac); //alert(store); // var dataString = 'mac=' + mac + 'store=' +store; $.ajax({ type: 'POST', url: 'ajax/subscribe.php', data: dataString, success: function(data) { $("#optoutform").show().html("&lt;h3&gt;You have successfully opted-out.&lt;/h3&gt;"); }, error: function(data) { $("#optoutform").show().html("&lt;h3&gt;There was an error processing your request.&lt;/h3&gt;"); } }); return valid; }); </code></pre> <p>Subscribe.php</p> <pre><code>$to = "request@domain.com"; $subject = "Request"; $mac = $_REQUEST['#mac'] ; $store = $_REQUEST['#store'] ; $headers = "From: request@domain.com"; $sent = mail($to, $subject, $mac, $store, $headers) ; </code></pre> <p>Update:</p> <p>Okay I have edited the subscribe.php to:</p> <pre><code>$to = "request@domain.com"; $subject = "Request"; $message = "&lt;h1&gt;Request&lt;/h1&gt;"; $message .= "&lt;strong&gt;MAC&lt;/strong&gt;: POST_$mac"; $message .= "&lt;strong&gt;Store&lt;/strong&gt;: POST_$store"; $headers = "From:youremail@domain.com"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html\r\n"; $sent = mail($to, $subject, $mail_body, $headers); </code></pre> <p>and have changed the dataString to the correct one, according to POST but still no email is sent to our inbox...</p> <p>What else could we be doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload