I am trying to create a simple forum using php to email the contents. Once the user clicks submit, I would like to have the div display a thank you message.
Currently going about this by trying to have the php write the html code using an if else statement. It seems the if statement is working, but the else statement is showing up as text.
Here is my code:
<?php
if(isset($_POST['submit'])) {
echo "<form method="post" action="">
<div class="field half first">
<label for="name">Name</label>
<input type="text" name="name" id="name" />
</div>
<div class="field half">
<label for="email">Email</label>
<input type="text" name="email" id="email" />
</div>
<div class="field">
<label for="message">Message</label>
<textarea name="message" id="message" rows="5"></textarea>
</div>
<input class="button submit" type="submit" name="submit" value="Submit">
</form>";
} else {
$email_to = "field25farming@gmail.com";
$email_subject = "Field 25 Contact Form";
echo "Thanks! We'll get back to you soon.";
}
?>
You can see the problem in the bottom of the page here if you'd like: http://field25.com/
I'm also open to other ways of achieving this, thanks for you help.