Not Solved PHP in Templates and Template Conditionals
Not Solved
I understand what you mean. I didn't notice that when looking through the code. You're basically checking if the fields are empty - in which case an error message is sent - but the email is sent anyway.

A more logical approach would be to only send the email if the fields are not empty. Otherwise an error message would be displayed. Here's some pseudo-code to give you a basic idea:

if(!empty(fields))
	mail([email protected], subject, message)
else
	echo "Error"

And yes, die() stops everything and outputs only what you specified. So that's not what you want to use here. Just echo out the message you want and move on. Also, your form is vulnerable to XSS attacks. You may want to escape the user's input (i.e. the $_POST variables).
Reply


Messages In This Thread
RE: PHP in Templates and Template Conditionals - by faviouz - 2012-01-03, 02:30 PM
RE: Template conditionals - by expat - 2015-01-31, 05:28 AM

Forum Jump:


Users browsing this thread: 49 Guest(s)