If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

PHP will have no idea what the JavaScript did, unless you somehow include the JavaScript results in the post/get data that is sent to the PHP script. (And note that JavaScript can be easily bypassed, either inadvertently by users with it disabled or maliciously by robot scripts or such, so you really need to do any important validation in the PHP script, too.)

PHP will have no idea what the JavaScript did, unless you somehow include the JavaScript results in the post/get data that is sent to the PHP script. (And note that JavaScript can be easily bypassed, either inadvertently by users with it disabled or maliciously by robot scripts or such, so you really need to do any important validation in the PHP script, too.)

Yep thats what is getting me confused. I want the functional checking like JS in PHP but I no it cannot be done and I cannot find a good example of a PHP contact form. Any Ideas?

I don't know: probably, but it's a built-in function. It just makes sure it's reasonably valid syntax, but does not rigidly enforce the standards.

Could I use Trim in this statement if so were?

Sure. I often apply trim() to the $_POST array separately via array_walk_recursive() before doing anything else with it.

Is captcha a good idea?

Only if you think you really need it, as users find it annoying.

How would I impliment a required section?

Not sure what you mean, but I think that's what the empty() check would be fore. If you want to enforce minimum or maximum numbers of characters, you can use strlen() to check the length, or substr() to just truncate any extra characters if that's desired.

Instead of having a if statement for every field in the form could I have it like this? My concept in my head is fine but I am having an issue to explain it.

PHP Code:

$values = new array('[B]gets data from the $_POST[/B]'); // I am unsure how I would do this? I have used php for years but this has been one of my biggest confusions

if(empty($values)) {
$errors[] = "Incorrect "'.$values.'" ";
}

[/quote]
You could set up some sort of array defining field names, types, minimum/maximum lengths, and so forth, then loop through that array to run a generic validation function on each.