Note that there are some explanatory texts on larger screens.

plurals
  1. POModalBox Email pass php variable to sms sender
    primarykey
    data
    text
    <p>Ok, so I use ModalBox to create an email form on my website..however, i need the modal box to send the email not to me, but to the user who added the car(its a car selling website), and so I need to pass the $email variable to the sendmessage.php.</p> <p>This is what i did so far: <code></p> <pre><code>$(document).ready(function() { $(".modalbox").fancybox(); $("#contact").submit(function() { return false; }); $("#send").on("click", function(){ setTimeout("$.fancybox.close()", 10); var emailval = $("#email").val(); var msgval = $("#msg").val(); var msglen = msgval.length; var mailvalid = validateEmail(emailval); if(mailvalid == false) { $("#email").addClass("error"); } else if(mailvalid == true){ $("#email").removeClass("error"); } if(msglen &lt; 4) { $("#msg").addClass("error"); } else if(msglen &gt;= 4){ $("#msg").removeClass("error"); } if(mailvalid == true &amp;&amp; msglen &gt;= 4) { // if both validate we attempt to send the e-mail // first we hide the submit btn so the user doesnt click twice $("#send").replaceWith("&lt;em&gt;Se trimite...&lt;/em&gt;"); $.ajax({ type: 'POST', url: 'http://automoka.ro/sendmessage.php', data: $("#contact").serialize(), success: function(data) { if(data == "true") { $("#contact").fadeOut("fast", function(){ $(this).before("&lt;p&gt;&lt;strong&gt;Mesajul a fost trimis!&lt;/strong&gt;&lt;/p&gt;"); setTimeout("$.fancybox.close()", 10); $_POST['contact'] = $email; }); } } }); } }); }); </code></pre> <p></code></p> <p>and in the php sender :</p> <pre><code>$email = $_POST['contact']; $sendto = $email; $usermail = $_POST['email']; $content = nl2br($_POST['msg']); if(@mail($sendto, $subject, $msg, $headers)) { echo "true"; } else { echo "false"; } </code></pre> <p>What am I doing wrong? Please help....Thanks in advance!</p> <p><strong>EDIT: Nevermind..figured it out!...I added another textarea which was hidden to the modalbox...and used post to get it to sendmessage.php.</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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