Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 27

Thread: PHP Mailing Different People

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

    Thumbs up

    hmp smart programming ... that would be where you come in. I was thinking and started doing it by making each phrase an array... and then trying to reference it and i was just going all wrong with it. I will try this snippet and let you know how things work out, if i can even figure this out haha.
    Last edited by lesham; 10-31-2006 at 12:13 PM.

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

    Default

    If you could, show the complete code from head to toes, that would be great, trying to see what im doing right/wrong.

  3. #13
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    PHP Code:
    <?
    /* The skeleton */

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

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

    $nameOfInfo = array(
    => "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(
        
    "john.doe@mail.com",
        
    "Homer.Sexual@moes.com",
        
    "trustno1@aol.com",
        
    "foo@bar.com",
        
    "blah@the.net",
        
    "president@whitehouse.gov"
    );

    $typeOfInfoPeople = array(
    1=> array("$list[0]$list[2]"NULLNULLNULL$list[5]),
        array(
    $list[1], $list[2], NULLNULLNULL$list[5]),
        array(
    NULL$list[2], NULL$list[5], NULL$list[5]),
        array(
    NULLNULLNULLNULLNULL$list[5]),
        array(
    NULLNULL, list[3], NULLNULL$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");
    ?>
    the form will change slightly to simplify variables:
    Code:
    <FORM action="myscript.php" method="post">
    <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>
    <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>
    <input type="submit" value="Send query">
    </form>
    Last edited by ItsMeOnly; 10-31-2006 at 01:33 PM.

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

    Default

    should something like this work?

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

    Default

    Parse error: parse error, unexpected '[', expecting '(' in C:\Inetpub\wwwroot\contactus.php on line 37

    37 = array(NULL, NULL, list[3], NULL, NULL, $list[5]),

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

    Default

    find the error, learn

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

    Default

    lol the error, was not on that line at all, it appears that i dont need the {} on the if/else statement, although it says
    We apologize. For the moment, we cannot provide feedback for
    ... and when the emails do send, it only posts
    , a Unknown Person wants to Comment on your website:
    Additional comment was:

    Hmmm...

  8. #18
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    nope, you only masked the error

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

    Default

    yes, i did figure the error out, but somereason its not posting ne data... does this script work for you?

    i tried over n over again and get the We apologize. For the moment, we cannot provide feedback for error...

  10. #20
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    show me your script and form too

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
  •