I have an html input form as well as a php email script that takes these values on the same page.
The problem is that before I submit any data into the forms I get a blank email because my php script is not waiting for the user input.
I don'y wan't to use another page for my email script because I don't want to pass variables through GET and I don't know how to implement sessions yet.
Thanks and here is my code
<div id = "center">
<form action="post.php" name="emailform" method="post">
<input type="text" name="name">
<input type="text" name="email">
<input type="text" name="message">
<input type="submit" value="Send Email">
</form>
</div>
<?php
if (!isset($_POST['submit'])) {
    echo 'you have hit the submit button';
    $name = $_POST['name'];
    $visitor_email = $_POST['email'];
    $message = $_POST['message'];
    $email_from = 'trustyclient@yoursite.com';
    $email_subject = "Message from client";
    $email_body = "Message from: $visitor_email \n \n Message:$message";
    $to = "myemail@myemail.com";
    $headers = "from:adam\r\n";
    mail($to,$email_subject,$email_body,$headers);
} else {
    echo 'You have not hit the submit button yet';  
}       
?>
 
     
     
    