SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: PHP Thing

  1. #1
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Thing

    Hi,

    i have these bits of code:

    Code:
       <select name='sig'>
                <option value='0'>None</option>
                <option value='hs' selected>Hosting Services</option>
                <option value='cs'>Community Services</option>
                <option value='am'>Automated Message</option>
                <option value='im'>Intranet Mailing</option>
                <option value='ac'>Alexander Cutts</option>
                <option value='cb'>Chris Bennett</option>
                <option value='ce'>ChaoticEnigma</option>
                <option value='jc'>Jason Cambre</option>
              </select>
    PHP Code:
    if ($action==mailsite) {
        if (
    $sig==0) {
            
    $sig "";
            
    mail("$to","$subject","$message\n\n$sig","From: $from");
        }
        if (
    $sig=='hs') {
            
    $sig "-------------------------------------------------------\nAtomic Online.net Hosted Services\nhosting@atomic-online.net";
            
    mail("$to","$subject","$message\n\n$sig","From: $from");
        }
        if (
    $sig=='cs') {
            
    $sig "-------------------------------------------------------\nAtomic Online.net Community Services\ncommunityservices@atomic-online.net";
            
    mail("$to","$subject","$message\n\n$sig","From: $from");
        } 
    (etc.)

    and it refuses to mail the signature bit at the bottom (the message has no signature)

    the code definatly points to mailsite etc

    any ideas?
    Nearly 7 years old!

  2. #2
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have found the mail() function in PHP to be very usefull, but also very hard to work with at times, since it is a little different than a basic print and run function (obviously). So here is my suggestion to you.

    Your code here is a little bit, ah, over done. You can do this very simply with a lot less lines of code.

    ie.
    PHP Code:
    if($sig == "hs"){
        
    $bottom "-------------------------------------------------------\nAtomic Online.net Hosted Services\nhosting@atomic-online.net";
    } elseif(
    $sig == "cs"){
        
    $bottom "-------------------------------------------------------\nAtomic Online.net Community Services\ncommunityservices@atomic-online.net";
    }

    mail("$name <$to>""$subject""$message\n\n$bottom""From: $from\r\nReply-to: $from"); 
    Try that and see what happens. Only declare the mail() once, instead of many times, and don't overwrite your $sig variable.

    God Bless,

    Alex
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services


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
  •