I have a bug on my contact form (working with JSON).
Can somebody help me to find it and fix it NOW...
I want the job to be done the next hour.
If not, do not bid.
error_reporting(E_ALL ^ E_NOTICE); // hide all basic notices from PHP
$nom = trim($_POST['name']);
$email = trim($_POST['email']);
$tel = trim($_POST['tel']);
$message = trim($_POST['comment']);
$url = trim($_POST['url']);
$emailTo = 'anymail;
$subject = 'Message from '.$nom;
$body = "Nom: $nom \n\nEmail: $email \n\nTelephone: $tel \n\nDemande: $message \n\nURL de la page de provenance: $url ";
$headers = 'From: ' .' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
$mailed = mail($emailTo, $subject, $body, $headers);
$json = json_encode(array('status' => "ok"));
$json = json_encode(array('status' => "error"));
header('Content-Type: application/json; charset=utf-8', true,200);
JS code included
12 freelancers are bidding on average €21 for this job
Dear Sir, I am really interested to work on this project, I can start the work now , and can provide the best services from my end. Please come on chat to discuss more about the project. Regards, Peter.
There is a ' missing from this line: $emailTo = 'anymail; Should be $emailTo = 'anymail'; I have your code running on my server with that line corrected with an email address and the email sends fine.