I have Apache and mySQL running, there doesn’t appear to be any syntax errors or any errors for that matter and I’ve literally exhausted all possible solutions, can someone please help me with this
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$checkbox = implode(', ', $_POST['checkbox']);
$message = $_POST['message'];
// Send email with form data
$to = '[email protected]';
$subject = 'Made In Havan - New Contact Form Submission';
$body = "Name: $firstName $lastNamenEmail: $emailnCheckbox: $checkboxnMessage: $message";
$headers = "From: $email";
if (mail($to, $subject, $body, $headers)) {
echo 'Message sent successfully';
} else {
echo 'Error sending message';
}
}
?>
I saved this file in my htdocs folder of my XAMPP installation folder as suggested
I inputted the php file into my react project as such:
axios.post('http://localhost/mihcontactform.php', formData)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
I am trying to test this (I created a dummy php file with echo Hello World and it showed up so there isnt any config issues) but a white blank page just shows up when I try to access localhost/mihcontactform.php