$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; } } } // validate the email address if (!empty($email)) { // regex to identify illegal characters in email address $checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/'; // reject the email address if it deosn't match if (!preg_match($checkEmail, $email)) { $suspect = true; $mailSent = false; unset($missing); } } // go ahead only if not suspsect and all required fields OK if (!$suspect && empty($missing)) { // set default values for variables that might not exist $interests = isset($interests) ? $interests : array('None selected'); $views = isset($views) ? $views : array('None selected'); // build the message $message = "Name: $name\n\n"; $message .= "Email: $email\n\n"; $message .= "Phone: $phone\n\n"; $message .= "Comments: $comments\n\n"; // limit line length to 70 characters $message = wordwrap($message, 70); // create additional headers $headers = 'From: Mindwise'; if (!empty($email)) { $headers .= "\r\nReply-To: $email"; } // send it $mailSent = mail($to, $subject, $message, $headers); if ($mailSent) { // $missing is no longer needed if the email is sent, so unset it unset($missing); } } } ?> Contact Mindwise
Mindwise logo. Click to return to the Mindwise home pageMindwise logo. Click to return to the Mindwise home page

Contact Mindwise

Dr. Cynthia R. Davis-Lockwood

Office:    Level 2, 156 Collins Street Melbourne Victoria 3000
E-mail: cynthia.davis@mindwise.com.au
Phone: (03) 9654 7757

Please complete the missing item(s) indicated.

Sorry, there was a problem sending your message. Please try later.

Your message has been sent. Thank you for your feedback.

/>
/>
/>