I have a contact form below and when I submit the contact form it sends me in another page saying "Your Message was sent!", but I don't want that so I need to just display a simple message inside the contact form saying "Your Message was sent"
And I found many threads here with submit forms on the same page but still wasn't able to do this and I'm very beginner with PHP and other back end languages so if someone would help me this would appreciate a lot.
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent= " From: $name,
Email: $email
Message: $message";
$recipient = "myemail@gmail.com";
$subject = "New Email";
$mailheader = "From: $email
";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error");
echo "Your Message was sent !";
?>
<form method="POST" action="contact-form.php">
<input name="name" type="text" class="message" placeholder="Name" />
<input name="email" type="text" class="message" placeholder="Email" />
<textarea name="message" class="message" placeholder="Your Message"></textarea>
<input type="submit" value="SUBMIT"/>
</form>
</div>