my entire form

okay can someone tell me why this doesn not give error messages when the user does not fill in the required information correctly??
… i know its really long… but its for school.

can’t tell u without seeing the code.

u may delete not relevant parts, to shorten it down.

// list expected fields
$expected = array(‘firstName’, ‘lastName’, ‘email’, ‘topics’, ‘deliveryfrequency’,
‘language’, ‘instructions’);
// set required fields
$required = array(‘firstName’, ‘lastName’, ‘email’, ‘topics’, ‘deliveryfrequency’,
‘language’);
// create empty array for any missing fields
$missing = array();

// process the $_POST variables
foreach ($_POST as $key => $value) {
// assign to temporary variable and strip whitespace if not an array
$temp = is_array($value) ? $value : trim($value);
// if empty and required, add to $missing array
if (empty($temp) && in_array($key, $required)) {
array_push($missing, $key);
}
// otherwise, assign to a variable of the same name as $key
elseif (in_array($key, $expected)) {
${$key} = $temp;
}
}

// go ahead only if all required fields OK
if (empty($missing))
{
// build the message
$message = “Name: $lastNamenn”;
$message .= “Email: $emailnn”;
$message .= “Comments: $instructions”;
} else {
//prepare an error message
echo (‘Please make sure that all *required fields are filled.’);

}

}

is “Please make sure that all *required fields are filled.” showing?

and what is the first line if u rightclick i ur browser and select “view html source”?

Sponsor our Newsletter | Privacy Policy | Terms of Service