######################################################################
$ws_count = 0;

if ($in{'as1'}) {
    ++ws_count;
}
if ($in{'as2'}) {
    ++ws_count;
}
if ($in{'an1'}) {
    ++ws_count;
}
if ($in{'an2'}) {
    ++ws_count;
}
if ($in{'ac1'}) {
    ++ws_count;
}
if ($in{'ac2'}) {
    ++ws_count;
}
if ($in{'ac3'}) {
    ++ws_count;
}

$name = $in{'name'};

if (($name eq 0) || (ws_count > 2) || (($in{'workshops'}) && ($ws_count = 0)))
{
  #sends back NO-GO for response form

  print "Content-type: text/html\n\n";
  print "<html>";
  print "<head>";
  print "<title>Cannot process response</title>";
  print "</head>";
  print "<body>";
  print "<hr>";
  print "<h2>Sorry\!</h2>";

  if ($name eq 0){
      print "Please make sure that the <i>Name</i> field \n";
      print "is filled in, then re-submit your response.\n";
      print "<p>";
  }

  if ($in{'workshops'}) {
      if (ws_count = 0) {
	  print "Please check off 1 or 2 boxes, indicating which \n";
	  print "workshop(s) you would like to attend.\n";
	  print "<p>";
      }
      if (ws_count > 2) {
	  print "You have indicated that you would link to attend ????? \n";
	  print "workshops.  You may only attend 1 or 2 workshops.\n";
	  print "Please check off only 1 or 2 boxes.\n";
	  print "<p>";
      }
  }
  else {
      if (ws_count > 2) {
	  print "You have indicated that you would link to attend ????? \n";
	  print "workshops.  You may only attend 1 or 2 workshops.\n";
	  print "Please check off only 1 or 2 boxes.\n";
	  print "<p>";
      }
  }

  print "<hr>";
  print "Use your browser's <i>back</i> button to return to the response \n";
  print "form, or click below to return to the Coalition Home Page.\n";
  print "<p>";
  print "<center>";
  print "<h3>Back to the <a href=\"http://dimacs.rutgers.edu/nj_math_coalition/\">";
  print "Coalition Home Page</a></h3>";
  print "</center>";
  print "</body>";
  print "</html>";
  #exit from the script
  exit;

}
######################################################################
