check($_POST['captcha_code']) == false) { $errors['captcha_error'] = 1; } if (!isset($answers['saletype']) || $answers['saletype'] == "") $errors['saletype_error'] = 1; if (!isset($answers['advertisement']) || $answers['advertisement'] == "") $errors['advertisement_error'] = 1; if (!isset($answers['contact']) || $answers['contact'] == "") $errors['contact_error'] = 1; if (!isset($answers['phone']) || $answers['phone'] == "") $errors['phone_error'] = 1; // if (!isset($answers['email']) || validate_email($answers['email']) == 0) // $errors['email_error'] = 1; if (!isset($answers['location']) || $answers['location'] == "") $errors['location_error'] = 1; if (!isset($answers['length']) || $answers['length'] == "") $errors['length_error'] = 1; if (count($errors) > 0) make_html($errors,$answers); else { // save it to xml $xml = "\n".date('j F y')."\n" ."".$answers['length']."\n" ."".$answers['saletype']."\n" ."".$answers['contact']."\n" ."".$answers['phone']."\n" ."".$answers['location']."\n" ."".$answers['email']."\n" ."".$answers['advertisement']."\n" ." \n"; $handle = fopen('sale.xml','a') or die('couldn\'t open file for writing'); if (fwrite($handle, $xml) === FALSE) die('couldn\'t write your ad to the file'); else header("location:forsale.php"); } } else { make_html(); } function block_regan($answers) { // Contact: Regan Phone: 027 532 7205 Location: Wellington Email: regan_cooze_setter@hotmail.com $phone = str_replace(' ','',$answers['phone']); return ($phone == '0275327205' || strtolower(trim($answers['email'])) == 'regan_cooze_setter@hotmail.com'); } function make_html($errors = array(),$answers = array()) { echo ' Triumph Owners Club: For Sale Form
» FOR SALE ADVERTISEMENT FORM
  1. The Triumph Owners Club does not accept responsibility for the content of these advertisements.
  2. Ads are removed after 4 or 8 weeks.
  3. Due to the popularity of the for sale page, we will now accept overseas ads but they must be submitted under "OVERSEAS" or they will be removed.
  4. Form will not submit unless all fields are filled in (except email).
Advertisement type:

 TRIUMPH FOR SALE (NZ only)

 PARTS (NZ only)

 WANTED (NZ only)

 OVERSEAS

Advertisement in your words (excluding contact details):
Contact name:
Contact phone/mobile number:
Location of Triumph or parts (City/Town):
Contact email address:
How long do you want to run the ad?  1 month   2 months
Please enter the code as shown: CAPTCHA ImageReload Image
 
'; } ?>