Jump to content

Email not sending when form count is reached.


jude56

Recommended Posts

My form should send an email when 10 areas of the form are filled in and submitted.

The count is working great, but the email is not going out.

 

 

if ($_POST['finished'] == 'Finished - Submit to Kent ISD') {

 

// Check to make sure ten textareas are filled in before finale submit

$tna = array('recycling_text1', 'recycling_text2', 'recycling_text3', 'recycling_text4', 'recycling_text5', 'recycling_text6', 'energy_text1', 'energy_text2', 'energy_text3', 'energy_text4', 'energy_text5', 'energy_text6', 'environ_text1', 'environ_text2','environ_text3', 'environ_text4', 'environ_text5', 'environ_text6', 'environ_text', 'environ_text', 'environ_text9','environ_text10','environ_text11');

 

$cnt = 0;

 

foreach ($tna as $ta) {

if (!empty($_POST[$ta]) && strlen($_POST[$ta]) > 1) {

$cnt++;

}

}

 

if ($cnt < 10) {

echo "<h1>You must reply to at least ten Results/What did you do? before you submit Finished.</h1>";

}

else {

$to = "[email protected]";

$subject = "Completed Green Schools Check List Submitted";

$District_Name = $_REQUEST['school'] ;

$email = $_REQUEST['email'] ;

$message = "A Green Schools Check List has been completed." . "\n";

$message .= "http://my.kentisd.org/Green_School/master_list.php" . "\n";

$headers = "From: $email";

$sent = mail($to, $subject, $message, $headers) ;

if($sent)

{print "Your mail was sent successfully"; }

else

{print "We encountered an error sending your mail"; }

 

}

 

  $updateGoTo = "http://my.kentisd.org/Green_School/checklist.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";

    $updateGoTo .= $_SERVER['QUERY_STRING'];

  }

 

}

 

if ($cnt >= 10) {

  header(sprintf("Location: %s", $updateGoTo));

}

 

}

 

mysql_select_db($database_db_green_school_app, $db_green_school_app);

 

$squery = "SELECT * FROM checklist WHERE checklist.email = '" . $_SESSION['MM_Username'] . "'";

$sresult = mysql_query($squery);

$row_rs_update = mysql_fetch_assoc($sresult);

 

?>

No. After a school registers and they login, the form has two submit buttons one saves the data so folks can come back to the form. The second button calculates if at least ten of the text areas have been filled out. If they have, an email is sent to let us know another school has completed the form. Everything is working except getting the email.

 

This is the link to the form. http://my.kentisd.org/Green_School/checklist.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.