require_once( "myw-lib.php" );
$msg = '';
$email_text = '';
if ( $_POST["Submit"] ) {
$db = connect();
$result = get_teams_by_email( $db, $_POST["email"] );
if ( $result === false ) $msg = "Sorry, could not retrieve your information ". mysql_error(); // remove mysql_error when live
elseif ( mysql_num_rows( $result ) == 0 ) $msg = "Sorry, this email is not in the database";
else {
$email_text .= "Measure Your World ID reminder:\n\nYour team(s):\n\n";
while ( $team = mysql_fetch_assoc( $result ) ) {
$email_text .= "Team: " . $team["Name"] . " , ID: " . $team["ID"] . "\n";
}
mail( $_POST["email"], "Measure Your World ID reminder", $email_text, 'From: myw_web@ucar.edu');
print("
Thank you. The reminder has been sent to " .$_POST["email"] .".
");
}
}
if ( empty( $email_text ) ) { ?>
Enter you email to get a Measure Your World ID reminder
} ?>