I have a html form on my index page and after the fields are been filled and submit button is clicked, the form action moves to a new page I named "indexform.php" but does not execute the php code on the "indexform.php" page.
Below is my html form code:
<form method="post" action="indexform.php">
<input name="name" type="text" class="form-control" placeholder="Your Name">
<input name="email" type="text" class="form-control" placeholder="Your Email">
<input name="subject" type="text" class="form-control" placeholder="Subject">
<input name="budget" type="text" class="form-control" placeholder="Your Budget">
<textarea name="message" id="" cols="30" rows="7" class="form-control" placeholder="What kind of content marketing services are you looking for?"></textarea>
<input type="submit" formaction="indexform.php" name="submit" value="Send Message">
</form>
Below is my php code on indexform.php page:
<?php
$mail_to_send_to = "joseph@digitage.net";
$from_email = "joseph@digitage.net";
$sendflag = $_REQUEST['sendflag'];
if ($sendflag == "send") {
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];
$name = $_REQUEST['name'];
$budget = $_REQUEST['budget'];
$headers = "From: $from_email" . "\r\n" . "Subject: $subject" . "\r\n" .
"Reply-To: $email" . "\r\n";
$a = mail($mail_to_send_to, "Message from a Home page contact form", $message, $headers);
if ($a) {
print("Message was sent, you can send another one");
} else {
print("Message wasn't sent, please check that you have changed emails in
the bottom");
}
}
?>
I don't get any message after the form action is been performed.