Jump to content

Recommended Posts

We are using a form to send to a certain person when information or service is requested.  We now have the need to use this form in another manor. There will now be 4 options on the form and if a certain option is picked then we want it to be sent to a specific person. So I was thinking a if statement or elseif would work. Then they told me that if multiple boxes are checked that it should go to multiple emails.  Am I correct that a if statement will not work in this case? What would I have to use to get this done.

 

I am sure that this is a easy answer but I am just learning PHP.

 

Thanks for the help.

Link to comment
https://forums.phpfreaks.com/topic/125653-form-question/
Share on other sites

<?php
if ($_POST['letter']) {
   $list = implode(', ',$_POST['letter']);
   echo $list;
}
?>

<form action = '' method = 'post'>
   <input type = 'checkbox' name = 'letter[]' value = 'a'>a <br />
   <input type = 'checkbox' name = 'letter[]' value = 'b'>b <br />
   <input type = 'checkbox' name = 'letter[]' value = 'c'>c <br />
   <input type = 'checkbox' name = 'letter[]' value = 'd'>d <br />
   <input type = 'submit' value = 'submit'>
</form>

Link to comment
https://forums.phpfreaks.com/topic/125653-form-question/#findComment-649706
Share on other sites

$emailTo = "[email protected]";

                //$emailTo = "[email protected]";

 

                // ESTABLISH THE SUBJECT LINE

                $subject = "subject";

 

// ASSEMBLE THE BODY OF THE EMAIL

                $emailBody = "<b>subject</b><br><br>";

 

                $emailBody .= "<b>Date & Time: </b><font color='blue'>$dateTime</font><br><br>";

 

$emailBody .= "Name: <font color='blue'>$Name</font><br>";

$emailBody .= "Phone: <font color='blue'>$Phone</font> Ext (if any): <font color='blue'>$PhoneExt</font><br>";

                $emailBody .= "Email: <font color='blue'>$Email</font><br>";

$emailBody .= "Address: <font color='blue'>$Address1<br />

$Address2<br />

$City<br />

$State<br />

$ZipCode</font><br>";

$emailBody .= "Services Interested in: <font color='blue'>$Service1<br />

  $Service2<br />

  $Service3<br />

  $Service4</font><br>";

 

$emailBody .= "<b>Notes/Instructions:</b><br>";

      $emailBody .= "<font color='blue'> $notesInstructions</font><br>";

 

                // ASSEMBLE THE EMAIL HEADERS

                $headers = "From: $Email\r\n";

                $headers .= "Reply-To: $Email\r\n";

                $headers .= "Return-Path: $Email\r\n";

                $headers .= "CC: \r\n";

                $headers .= "BCC: \r\n";

                $headers .= "MIME-Version: 1.0\r\n";

                $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

 

                // SEND THE EMAIL

                if ( mail ($emailTo,$subject,$emailBody,$headers) ) {

 

 

 

This is the code that the current webmaster is using. So can I just use the post command to achieve my goal. Again thanks for the help as I am just learning php and trying to help someone else.

Link to comment
https://forums.phpfreaks.com/topic/125653-form-question/#findComment-649769
Share on other sites

$subject=htmlspecialchars($_POST['subject']);
$message=htmlspecialchars($_POST['message']);
//see what the subject is to test the game
if($subject=="Careers"){
$to = "[email protected]";
}
if ($subject=="Business Solutions"){
$to = "[email protected]";
}
if ($subject=="Web Administrator"){
$to = "[email protected]";
}
if ($subject=="Customer Feedback"){
$to = "[email protected]";
}

Link to comment
https://forums.phpfreaks.com/topic/125653-form-question/#findComment-649782
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.