Contact


Mailing Address:

Mary F. Masterson
1095 Evergreen Circle, #200
The Woodlands, TX 77380

Phone: 713-703-3297

Send a Message

>>>>>>>>>> Function to get POST data else default <<<<<<<<<<< // --------------------------------------------------------------- function ckdata(array &$flags) // pos 1 is submit flag & pos 2 is error flag { // test for null $flags[errflag]=0; // form errors flag if (empty($_POST[varlist][name])) { $flags[errflag]=1; // if Submit button clicked set stat flag if ($flags[subflag] == 1) { $_POST[varlist][name] = 'Please enter your name'; } } else { // execute even if not submitted? // data posted; trim the data $_POST[varlist][name] = trim($_POST[varlist][name]); // check length & flag any error if (strlen($_POST[varlist][name])<3) { $_POST[varlist][name] = "Please enter your name."; $flags[errflag]=1; } } // end of processing for name field // Process the email field if (empty($_POST[varlist][email])) { $flags[errflag]=1; // if Submit button clicked set stat flag if ($flags[subflag] == 1) { $_POST[varlist][email] = "Please enter a valid email address."; } } else { // data posted; trim the data $$_POST[varlist][email] = trim($_POST[varlist][email]); $$_POST[varlist][email] =filter_var($$_POST[varlist][email], FILTER_SANITIZE_EMAIL); // check lengt`h & flag any error if (!filter_var($_POST[varlist][email], FILTER_VALIDATE_EMAIL) ) { $_POST[varlist][email] = "Please enter a valid email address."; $flags[errflag]=1; } }// end of processing for email field // Process the message field if (empty($_POST[varlist][mesg])) { $flags[errflag]=1; // if Submit button clicked set stat flag if ($flags[subflag] == 1) { $_POST[varlist][mesg] = 'Please leave a message.'; } } else { // data posted; trim the data $_POST[varlist][mesg] = trim($_POST[varlist][mesg]); // check length & flag any error if (strlen($_POST[varlist][mesg])<2) { $_POST[varlist][mesg] = "Please leave a longer message."; $flags[errflag]=1; } } // end of processing for message field // Process only if no other errors if ( $flags[errflag] !=1) { // Process the Vercode field if (empty($_POST[varlist][vercode])) { $flags[errflag]=1; // if Submit button clicked set stat flag if ($flags[subflag] == 1) { $_POST[varlist][vercode] = 'Please answer verification question.'; } } else { // data posted; trim the data $_POST[varlist][vercode] = trim($_POST[varlist][vercode]); // check cwecode & flag any error // if ($_POST[varlist][vercode] != $_SESSION["vercode"] OR $_SESSION["vercode"] !="fire") if ($_POST[varlist][vercode] != "three") { $_POST[varlist][vercode] = "Incorrect verification."; $flags[errflag]=1; } } // end of processing for non-empty vercodeercode field */ } // end of processing for vercodeercode field */ } // end of function def // --------------------------------------------------------------- // >>>>>>>>>>> Function to display form <<<<<<<<<<< // --------------------------------------------------------------- function showForm($Next) { // >>>> The Method & Action of the Form <<<<<<<<<<< echo '
'; echo '
'; // Display Name field echo '
'; // Display Email field echo '
'; // Display Message field echo '
'; // Display field echo '
'; // >>>> The Submit Button of the Form <<<<<<<<<<< if ($Next=='') // no send value { echo '
'; } else { echo '
'; } echo '
'; echo '
'; echo '
'; echo '
'; } // End of Function showform <<<<<<<<<<<<<<<<<<<, // --------------------------------------------------------------- // >>>>>> Main Program<<<<<<<< // --------------------------------------------------------------- $theflags = array('subflag', 'errflag'); // blank form so initialize flag $Next= ""; // defaults to same page $theflags[subflag]=0; // form submitted flag // check if POST variable empty if (isset($_POST[SubmitForm])) // Submit button clicked // check POST data & set flags { $theflags[subflag]=1; // flag as submitted // validate the data entered ckdata($theflags); // if no errors go the next page if (!$theflags[errflag]) { // --------------------------------------------------------------- // Send the email $to = "mary@maryfmasterson.com"; $subject = "Legal Inquiry"; $headers = "From: "; $headers .= $_POST[varlist][name]; $headers .= " <"; $headers .= $_POST[varlist][email]; $headers .= "> \r\n"; $hidn = chr(109); $hidn .= chr(97); $hidn .= chr(114); $hidn .= chr(121); $hidn .= chr(64); $hidn .= chr(109); $hidn .= chr(97); $hidn .= chr(114); $hidn .= chr(121); $hidn .= chr(102); $hidn .= chr(109); $hidn .= chr(97); $hidn .= chr(115); $hidn .= chr(116); $hidn .= chr(101); $hidn .= chr(114); $hidn .= chr(115); $hidn .= chr(111); $hidn .= chr(110); $hidn .= chr(46); $hidn .= chr(99); $hidn .= chr(111); $hidn .= chr(109); /* When PHP is talking to a SMTP server directly, if a full stop is found on the start of a line, it is removed. To counter-act this, replace these occurrences with a double dot. */ $mesg = $_POST[varlist][mesg]; $mesg = str_replace("\n.", "\n..", $mesg); if(mail($hidn, $subject, $mesg, $headers)) {echo "Thank you. Your message was received.";} else {echo "Oops. An error occurred. Please check that you spelled your email address correctly."; } exit(""); } // end of else (Submit button clicked) } // SHOW THE FORM with initial action of display same page when Submit clicked<<<<<<<<<<<<<<< showform($Next); // send data to server & post back to browser via POST variable ?>