I would like this php form to pop up an alert box on completion or if there is error.
What do I need to add or change to this to make that happen, or is that added javascript?
<?php
$name = $_POST['fullname'];
$email = $_POST['email'];
$message = $_POST['comment'];
$from = 'From: Contact Form';
$to = 'email@domain.com';
$subject = 'Hello';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
}
?>
In the page that would display the error, you would add javascript to pop up the message using the alert() function. You could use php to conditionally output this javascript. Oy vey.
Example:
Something like that.