no problem. I personally prefer PHP over formmails, since it's my own code and I don't have to use any hidden variables in the code.
You can put this code in a separate PHP file or in the same on as the form. If you put it in the same one as the form, you'll just need to check if the user has submitted the form. Here's the basic logic-flow.
SUBMIT
- Yes -> Check Form Input
- No -> Display Form
CHECK FORM INPUT (Required Fields were filled out properly)
- Yes -> Process Form
- No -> Display form with error messages
PROCESS FORM (check that mail is sent)
- Yes -> Display a message to user saying their info has been submitted
- No -> Display an error saying there was a problem sending their email
If you're on the same script (which helps avoid too many PHP files), you could do something like this:
First, assign a name='submit' to your submit button in HTML so that we can grab that variable by it's name in PHP. Then, to check if the form has been submitted:
<?php
if( isset($_POST["submit"]) )
{
// Display Form here - Could be object, or put the HTML here.
$form->DisplayForm();
}
else
{
// Form has not been submitted
// Error checking, send the email, then display message on success.
}
?>