InMotion Hosting Support Center

php form send to email

Category: Email

n/a Points
2014-03-06 2:08 pm EST

Hits: 83
I am reviewing your php email form code. You have validation code, send email code and form coding. Does it matter what order the php code is in? My thought is that the validation code should proceed the form code then the send to email code. I appreciate the help.

You must login before you can ask a follow up question.

You must login before you can submit an answer.



9,968 Points
2014-03-06 2:33 pm EST
Hello, and thanks for your question.

I believe you might be talking about our create a custom PHP contact form with validation guide.

The order of the PHP code itself on that page should work fine, but you could possibly re-order it for your own needs if it's easier to think about that way for you.

For instance the validation code is at the top, but this could also come after the HTML form itself if you wanted it to. PHP code is processed from top to bottom, so the order of your code can matter, but in this case you'll see the first line of the validation code is checking to see if we've submitted the HTML form yet:

if (isset($_REQUEST['submitted'])) {

So even if this code is above our HTML form code, it won't actually run until the form has been submitted. So we setup the validation code, then the code to send the email if validation passes, then some error reporting code, and finally the HTML form code itself.

I hope that makes sense, please let us know if you had any further questions at all.

- Jacob

You must login before you can post a comment about this answer.

Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

Social Login Joomla

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!