Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

Thread: PHP Mailing Different People

  1. #21
    Join Date
    Oct 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    <?

    $who = $_POST['who'];
    $typeOfInfo = $_POST['typeOfInfo'];

    $nameOfWho = array(
    1 => "Prospective insured",
    "Prospective agent",
    "Insured",
    "Agent",
    "Unknown Person"
    );

    $nameOfInfo = array(
    1 => "Request Claim Information",
    "Request information about my policy",
    "Request information about obtaining my policy",
    "Request my password",
    "Comment on your website",
    "Contact you on an unlisted topic"
    );

    $list = array(
    "lesham@farmersosfalem.com",
    "lesham@farmersosfalem.com",
    "lesham@farmersosfalem.com",
    "lesham@farmersosfalem.com",
    "lesham@farmersosfalem.com",
    "lesham@farmersosfalem.com"
    );

    $typeOfInfoPeople = array(
    1=> array("$list[0], $list[2]", NULL, NULL, NULL, $list[5]),
    array($list[1], $list[2], NULL, NULL, NULL, $list[5]),
    array(NULL, $list[2], NULL, $list[5], NULL, $list[5]),
    array(NULL, NULL, NULL, NULL, NULL, $list[5]),
    array(NULL, NULL, NULL, NULL, NULL, $list[5]),
    array("$list[0], $list[1]",
    "$list[0], $list[2]",
    "$list[0], $list[3]",
    "$list[0], $list[4]",
    "$list[0], $list[5]",
    "$list[0], $list[1], $list[2], $list[3], $list[4], $list[5]"
    )
    );

    $post = "$name, a ". $nameOfWho[$who].
    " wants to ". $nameOfInfo[$typeOfInfo] .
    ":
    Additional comment was:
    $comment\n";

    $mailing = $typeOfInfoPeople[$typeOfInfo][$who];

    if (!$mailing)
    die("We apologize. For the moment, we cannot provide feedback for ". $typeOfWho[$who]);
    else
    mail($mailing,
    "An information requested",
    $post) or die("Mail session failed! The query was not sent, contact the administrator");

    ?>




    <form name=contactus method="POST" action="contactus.php" target=_self onsubmit="return formCheck(this);">
    <tr><td align="left"><font size="2">First Name</font></td>
    <td align="left"><input name="First Name" value size="35" maxlength=16 value=""></td></tr>
    <input type="hidden" name="r_Fisrt Name" value="First Name Is Required">
    <tr><td align="left" height="24"><font size="2">Last Name</font></td>
    <td align="left" height="24"><input type="text" name="Last name" size="35" maxlength=32 value=""></td></tr>

    <tr><td align="left"><font size="2">Company</font></td>
    <td align="left"><input type="TEXT" name="Company" value size="35" maxlength=32 value=""></td></tr>

    <tr><td align="left"><font size="2">Street Address</font></td>
    <td align="left"><input type="text" name="Street" size="35" maxlength=32 value=""></td></tr>
    <tr><td align="left"><font size="2">City</font></td>
    <td align="left"><input type="text" name="City" size="35" maxlength=20 value=""></td></tr>
    <tr><td align="left"><font size="2">State</font></td>
    <td align="left"><input type="text" name="State" size="35" maxlength=2 value=""></td></tr>
    <tr><td align="left"><font size="2">Zip Code</font></td>
    <td align="left"><input type="text" name="ZipCode" size="35" maxlength=5 onblur= valzip(); value=""></td></tr>
    <tr><td align="left"><font size="2">Policy Number</font></td>
    <td align="left"><input type="text" name="Policy" size="35" maxlength=16 value=""></td></tr>
    <tr><td align="left"><font size="2">Daytime Phone</font></td>
    <td align="left"><input type="TEXT" name="Telephone" value size="35" maxlength=16 value=""></td></tr>
    <tr><td align="left"><font size="2">E-mail<br>
    <br>
    <br>
    <br>
    <br>
    &nbsp;</font></td>
    <td align="left"><input type="TEXT" name="Email" value size="35" maxlength=40 value=""><br>
    <br>
    <br>
    <br>
    <br>
    &nbsp;</td></tr>
    </table>
    </td>
    <td width="303" colspan="2">
    <p align="left">


    I am a/an :</p></td>
    </tr>
    <tr>
    <td width="303" colspan="2">


    <SELECT NAME="who">
    <OPTION VALUE="1">Prospective insured</option>
    <OPTION VALUE="2">Prospective agent</option>
    <OPTION VALUE="3">Insured</option>
    <OPTION VALUE="4">Agent</option>
    <OPTION VALUE="5" selected="selected">Uknown Person</option>
    </SELECT></td>
    </tr>
    <tr>
    <td width="303" colspan="2">
    <font size="2">I wish to :
    </font></td>
    </tr>
    <tr>
    <td width="303" colspan="2">


    <select name="typeOfInfo">
    <OPTION VALUE="1">Request Claim Information</option>
    <OPTION VALUE="2">Request information about my policy</option>
    <OPTION VALUE="3">Request information about obtaining my policy</option>
    <OPTION VALUE="4">Request my password</option>
    <OPTION VALUE="5">Comment on your website</option>
    <OPTION VALUE="6">Contact you on an unlisted topic</option>
    </select></td>
    </tr>
    <tr>
    <td width="303" colspan="2">
    <font size="2">Message/Question</font> <!--<input type=text name=Comments size=35>--></td>
    </tr>
    <tr>
    <td width="303" colspan="2">
    <textarea name="comment" rows="9" cols="50" maxlength=800 value=""></textarea></td>
    </tr>
    <tr>
    <td width="303" colspan="2">
    <font size="2">User Verification: 1 + 2 =</font> <input type=text size=2 name=verify></td>
    </tr>
    <tr>
    <td width="63">
    <input type="submit" onSubmit="return checkmail(this)" value="Submit" name="B1"></td>
    <td width="236">
    <input type="reset" value="Cancel" name="B2"></td></form>
    Last edited by lesham; 10-31-2006 at 04:46 PM.

  2. #22
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    While everything is fine, you literally passed out the "nulls", so the script will work in just 7 cases...

  3. #23
    Join Date
    Oct 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    what do you mean? did i miss something?

  4. #24
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    you wanted to send out to different people, for now it's just one address only, and bunch of nulls

  5. #25
    Join Date
    Oct 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i want to be able to send an email based on the decision of drop down 1 + drop down 2.... is it possible within this code?

  6. #26
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    it's not just possible, it's already there, you just need to fillout the twodimensional array (or rather array of arrays) with address strings (and to make things easier, I introduced an array with email addresses so you just need to enter member numbers instead of repeating strings of email addresses).

  7. #27
    Join Date
    Oct 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ugh now to get it to work, thanks alot, sorry for me being a pain in the ass, i dont do php so well... im more of a C# person but im only 18 and learning

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •