Jump to content

Help with my E-mail form


joebpa

Recommended Posts

I am attempting to have one form that can potentially send to multiple E-mail addresses depending upon which address is found in the main page. The form will send E-mail if i specify the address, but not when i use the $recipient.
Windows 2003 web edition
PHP 5.1.6
IIS 6
Here is the form:
<HTML>
<HEAD>
<TITLE>mail</TITLE>
</HEAD>
<BODY>
<?php
//define who is to receive the mail
$mailTo = $recipient;

//set the subject
$mailSubject = $subject;

            //build body of the message
$mailBody = "This is the content of the mail received to Prime: \n\n";

//add a from header
$mailHeaders = "From: PW-Server Liberty Form Mailer\n";

//send mail
// print("Submitting the following information:<P>");
  while ($slice = each($_POST)){
//print($slice[0]." = ".$slice[1]."<BR>");
$mailBody .= $slice[0];
$mailBody .= "=".$slice[1];
$mailBody .= "\n\n";
}

if(mail($mailTo, $mailSubject, $mailBody, $mailHeaders)){
  //  if(mail($mailTo, $mailSubject, $mailBody, $mailHeaders)){
print("<h2>Your form was successfully submitted.</h2>");
print("<b>Thanks!</B>");
}else{
print("<h2>Submission Failed!</h2>");
}

?>
</BODY>
</HTML>

If i replace the $recipient with an E-mail account it will send with all information contained in the HTML form.

This is what the HTML form looks like:
<html>
<head>
<title>Liberty Formals</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<Body>
<Table>

            <form action="http://www.libertyformals.com/formmail.php" method="post">
              <input type=hidden name="recipient" value="[email protected]">
              <input type=hidden name="subject" value="Liberty Tux Reuest">
              <input type=hidden name="redirect" value="http://www.libertyformals.com/contresponse.htm">
              Name:
              <input type="text" name="Name" size="33" maxlength="100">
              <br>
              Company:
              <input type="text" name="comp" size="30" maxlength="100">
              <br>
              Address 1:
              <input type="text" name="add1" size="30" maxlength="100">
              <br>
              Address 2:
              <input type="text" name="add2" size="30" maxlength="100">
              <br>
              City/State/Zip:
              <input type="text" name="city" size="15" maxlength="100">
***removed the rest so it wouldnt be so long.

The form pulls the subject line and redirects me, but will not pull the recipient line?

Can anyone shed some light for me. ???
Link to comment
https://forums.phpfreaks.com/topic/26346-help-with-my-e-mail-form/
Share on other sites

From what you have mentioned i gather that the ($mailTo can be replaced with the $recipient in any area?). If this is true teh what you have mentioned would make sense. Does teh mailing program within PHP understand that i am not using the $mailTo, but instead the $recipient?

On your comment about the posting ($_post) in teh form towards the bottom of it tehre are entries that use a $slice to pull the $_post. Is this what you were talkign about? Please bear in mind i didnt not write this i am playing catch up on the problem.

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.