Jump to content

Form Processing issue


stmosaic

Recommended Posts

Been working on this for weeks and am quite frustrated that none of my varied modifications have made much of a difference. Is anybody able to help me out with this? I have abbreviated the code to highlight the problem areas.

 

When the form data is emailed, if more than one checkbox (each with a distinct name & value), is checked, the info output in the email of selections #2 and #3 are repeated 2 - 3 times. Other than that small glitch, everything works perfectly.

 

Abbreviated code is below. I would greatly appreciate any help with this!

FORM CODE SNIPPET

	<input type="checkbox" name="city0" value="CryC">
      	<input type="checkbox" name="city1" value="CH">
      	<input type="checkbox" name="city2" value="OB">

 

ABBREVIATED PROCESSOR CODE

$if ($formname == "accom" && isset($CryC))
{ $SendTo = "[email protected]";
$SubjectLine = "CRYSTAL COAST $formname Lead from\n";
//Variable processing//	
include 'fprocessA.php';

// Send E-Mail //
if (count($_POST) != 0)
{
      $Spam = false;

      foreach ($_POST as $Field=>$Value)
	{
          $Spam = $Spam || stristr($Value, "bcc: ");
	}

      if (!$Spam)
          {
          $mailheaders = "From: $SendFrom \r\n";
          $mailheaders .= "Reply-To: $Reply_To \r\n";
          mail($SendTo, $SubjectLine, $MsgBody, $mailheaders);
          }
}
  
  }

if ($formname == "accom" && isset($CH))
{ $SendTo = "[email protected]";
$SubjectLine = "CHARLESTON SC $formname Lead from\n";

include 'fprocessA.php';

// Send E-Mail //
if (count($_POST) != 0)
{
      $Spam = false;

      foreach ($_POST as $Field=>$Value)
	{
          $Spam = $Spam || stristr($Value, "bcc: ");
	}

      if (!$Spam)
          {
          $mailheaders = "From: $SendFrom \r\n";
          $mailheaders .= "Reply-To: $Reply_To \r\n";
          mail($SendTo, $SubjectLine, $MsgBody, $mailheaders);
          }
}
   
}

if ($formname == " accom" && isset($OB))
{ $SendTo = "[email protected]";
$SubjectLine = "NC OUTER BANKS $formname Lead from\n";

include 'fprocessA.php';

// Send E-Mail //
if (count($_POST) != 0)
{
      $Spam = false;

      foreach ($_POST as $Field=>$Value)
	{
          $Spam = $Spam || stristr($Value, "bcc: ");
	}

      if (!$Spam)
          {
          $mailheaders = "From: $SendFrom \r\n";
          $mailheaders .= "Reply-To: $Reply_To \r\n";
          mail($SendTo, $SubjectLine, $MsgBody, $mailheaders);
          }
}
  
}

Link to comment
https://forums.phpfreaks.com/topic/61550-form-processing-issue/
Share on other sites

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.