'CEVITTS 2012, Day 1 (March 27)', 'cevitts_day2' => 'CEVITTS 2012, Day 2 (March 28)' , ); // Form data $formdata = array( "captcha" => isset($_POST['captcha']) ? trim($_POST['captcha']) : "", "promocode" => isset($_POST['promocode']) ? trim(strtolower($_POST['promocode'])) : "", "company" => isset($_POST['company']) ? trim($_POST['company']) : "", "jobrole" => isset($_POST['jobrole']) ? trim($_POST['jobrole']) : "", "expertise" => isset($_POST['expertise']) ? trim($_POST['expertise']) : "", "address" => isset($_POST['address']) ? trim($_POST['address']) : "", "city" => isset($_POST['city']) ? trim($_POST['city']) : "", "postalcode" => isset($_POST['postalcode']) ? trim(strtoupper($_POST['postalcode'])) : "", "phone" => isset($_POST['phone']) ? trim(strtolower($_POST['phone'])) : "", "mobile" => isset($_POST['mobile']) ? trim(strtolower($_POST['mobile'])) : "", "invoice" => isset($_POST['invoice']) ? trim($_POST['invoice']) : "", "comment" => isset($_POST['comment']) ? trim($_POST['comment']) : "", "needs" => isset($_POST['needs']) ? trim($_POST['needs']) : "", "payment" => isset($_POST['payment']) ? trim($_POST['payment']) : "online", "21may" => isset($_POST['21may']) ? trim($_POST['21may']) : "Nee", "1011june" => isset($_POST['1011june']) ? trim($_POST['1011june']) : "Nee", "participants" => array(), ); $errors = array(); if (isset($_POST['captcha']) && $captcha != $formdata['captcha']) { $errors[] = 'PLEASE, FILL IN THE WORD AS SHOWN TO PROVE YOU ARE NOT A SPAMBOT.'; } // Participants for ($i = 0; $i < $participants; $i++) { $participant = array( "firstname" => "", "lastname" => "", "email" => "", ); // Fields foreach ($participant as $field => &$value) { if (isset($_POST[$field][$i])) { $value = $_POST[$field][$i]; } } $formdata['participants'][] = $participant; } // If the form was submitted if (empty($errors) && isset($_POST['action'])) { // Example code: Adjust price if the first participant has filled in a first name if (!empty($formdata['participants'][0]['lastname'])) { $price += 0.00; } // The same for the second participant if (!empty($formdata['participants'][1]['lastname'])) { $price += 477.95; } // The same for the third participant if (!empty($formdata['participants'][2]['lastname'])) { $price += 477.95; } // The same for the fourth participant if (!empty($formdata['participants'][3]['lastname'])) { $price += 477.95; } // The same for the fifth participant if (!empty($formdata['participants'][4]['lastname'])) { $price += 477.95; } // Count the number of participants with a filled in first name $participantcount = 0; foreach ($formdata['participants'] as $participant) { if (!empty($participant['firstname'])) { $participantcount++; } } // Apply promotion codes if ($formdata['promocode'] == 'ngi2015-hjuig8erg9') { $price = $price -477.95 * $participantcount; } // Order data $price = round($price, 2); $orderid = uniqid(); $email = $formdata['participants'][0]['email']; // Write result to CSV $csvfile = '/home/bita/csv/pfr-2016-1july.csv'; // Make sure this file can be written to if (!file_exists($csvfile) || filesize($csvfile) == 0) { // New file, create and add headers $csv = fopen($csvfile, 'a'); $headers = array( 'Order id', 'Company/School', 'Function', 'Expertise', 'Address', 'City', 'Postal code', 'Phone number', 'Mobile number', 'Materials', 'Needs', 'Comment'); for ($i = 0; $i < $participants; $i++) { $headers[] = 'First name'; $headers[] = 'Last name'; $headers[] = 'Email'; } fputcsv($csv, $headers); fclose($csv); } $csv = fopen($csvfile, 'a'); $fields = array(); $fields[] = date('d-m-Y H:i:s'); $fields[] = $orderid; $fields[] = $formdata["company"]; $fields[] = $formdata["jobrole"]; $fields[] = $formdata["expertise"]; $fields[] = $formdata["address"]; $fields[] = $formdata["city"]; $fields[] = $formdata["postalcode"]; $fields[] = $formdata["phone"]; $fields[] = $formdata["mobile"]; $fields[] = $formdata["invoice"]; $fields[] = $formdata["needs"]; $fields[] = $formdata["comment"]; foreach ($formdata['participants'] as $participant) { $fields[] = $participant["firstname"]; $fields[] = $participant["lastname"]; $fields[] = $participant["email"]; ; } fputcsv($csv, $fields); fclose($csv); // Create email $body = ""; $body .= "\n"; $body .= "Company/School: ". $formdata["company"] ."\n"; $body .= "Function: ". $formdata["jobrole"] ."\n"; $body .= "Expertise: ". $formdata["expertise"] ."\n"; $body .= "Company/School: ". $formdata["company"] ."\n"; $body .= "Address: ". $formdata["address"] ."\n"; $body .= "City: ". $formdata["city"] ."\n"; $body .= "Postal code: ". $formdata["postalcode"] ."\n"; $body .= "Phone number: ". $formdata["phone"] ."\n"; $body .= "Mobile number: ". $formdata["mobile"] ."\n"; $body .= "Comment: ". $formdata["comment"] ."\n"; $body .= "\n"; $body .= "Participants:\n\n"; foreach ($formdata['participants'] as $participant) { $body .= " First name: ". $participant["firstname"] ."\n"; $body .= " Last name: ". $participant["lastname"] ."\n"; $body .= " Email: ". $participant["email"] ."\n"; $body .= "\n"; } $headers = "Content-Type: text/plain\r\n"; $headers .= "From: Plastic Free Rivers \r\n"; // Send e-mail mail("jv@bita-center.com, suze.vd.meulen@pwn.nl", "Plastic Free Rivers Makathon", $body, $headers); mail($email, "Automatic Confirmation Plastic Free Rivers Makathon", $body, $headers); // Redirect if there was no price if ($price < 0.01) { header("Location: validation1.html"); exit(); } // Display payment form if ($formdata['payment'] == 'online') { ?>

Online Payment Number

Subscription fee:

'. $error .'

'; } } ?>

 



Yes, I would like to be kept in the loop for the next Plastic Free Rivers Makathon

$participant) { ?>

First name:* 0 ? " ". ($i + 1) : ""; ?>
Last name:*
E-mail:*
 

 

 

School/University/Company:
Function:
Expertise:
Personal Address:
City:
Postal code:
Phone:
Mobile:
SPAM CHECK:


Please enter the word "" to prove you are not a spambot.

 

Additional comments/remarks:



 

* = required

 

More information:

Tel. +31 612 47 65 51 | E-mail: info@plasticfreerivers.com