I appreciate your feed back.
But I am not the one asking a question on this thread. I am providing help to a person who had a question that has been answered for days now. as for putting php and html in the same file it should be avoided in most cases due to security risks. a few examples being when connecting to a database, dealing with a page controlled by a session, or when your passing personal information that should be secure through the server. At the end of the day to each his own and I think its important to see many different examples on how to accomplish any task. The more examples people are given when asking a question on a forum the better, because it allows them to have a better idea of what they are doing. its hard to learn for some people because there are so many ways to accomplish the same task.
I make a point to answer as many questions as I can because I to have questions and i appreciate when people answer my questions promptly.
I personally like my files to be organized easy to read and secure. So I make a point to avoid mixing php and html unless there is a reason for it.
I think for the sake of being helpful to the person who started this thread, it would be more productive to give them an example of the way you would accomplish
this task instead of telling me you don't like the way I structure my code. unfortunately all that does is leave confusion for someone who comes along looking for
an answer on this thread and the last post they see is your post telling me what you feel I did wrong with out giving an example of how you feel the correct way of doing this was.
I am sure you have your own style as I have mine, and I am sure it will be helpful for people to see because in some cases some people might find my code was easier for them to understand
and in other cases people may relate better to the way you do things.
Here is a reference to some common mistakes done with php.
I realize this is an email form but just recently I was working on a form with a person who wanted to keep the email address private. That means it was necessary to keep the php in a separate file. So i try to keep good habits instead of picking and choosing when to make a simple script less secure just for the sake of not feeling like its necessary to be more secure on this one.
Hope to see an example from you so we can add some more content to the site. The More examples more questions get answered.
Also if you are seeing something in my script that is wrong please elaborate. I am here to learn and appreciate any chance to learn something new.