www.webdeveloper.com
Results 1 to 3 of 3

Thread: PHP beginner could use some help here!

  1. #1
    Join Date
    Aug 2006
    Posts
    2

    Question PHP beginner could use some help here!

    Well hell, I won't know unless i ask! Just stumbled across this place whilst trying to solve a problem with a PHP script so i figured i'd see if anyone can point me in the right direction.

    I'm new to this, just finding my way to web design so bear with me if i sound like i ain't quite with it sometimes...it's because i'm not!

    I'm trying to run a very basis PHP script for a feedback form but cannot seem to get it to work...

    The form is at www.hovis21.sendmail.html
    It is run on a windows server

    I had tried the following as a script:
    PHP Code:
    <?php
      $email 
    $_REQUEST['email'] ;
      
    $message $_REQUEST['message'] ;

      
    mail"root@hovis21.com""Feedback Form Results",
        
    $message"From: $email);
      
    header"Location: http://www.hovis21.com/sendmail_thanks.html" );
    ?>
    The form works but no email is generated. I have since found out from streamline.net who host the site that i need to alter the script to stop potential spam....they told me to:

    "Use the PHP mail function and set the mail from using the following line of code.
    PHP Code:
    ini_set("sendmail_from"" root@hovis21.com "); 
    When i try to replace
    PHP Code:
    "From: $email); 
    with this I just get a parsing error...unsurprising since i'm not sure if i'm doing the right thing and i can't get a more detailed answer from streamline.

    Anyway, just wondered if anyone out there could show me where i'm going wrong. I'd like to teach myself PHP scripting but it seems i've fallen at the first hurdle!

    Cheers
    Tom

  2. #2
    Join Date
    Mar 2005
    Location
    Costa Del Horden
    Posts
    65
    I always use this code


    Code:
    $subject = "You have new email";
    $to = "email to send to";
    $toname = "name of who your sending the mail to";
    $body = "email message here";
    
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'To: '.$to.' '.$toname.' <'.$toname.'>' . "\r\n";
    $headers .= 'From: Whoeveryouare <null@me.co.uk>' . "\r\n";
    
    mail($to, $subject, $body, $headers);
    hope thats useful, will allow you to put HTML code in the email as well.

  3. #3
    Join Date
    Aug 2006
    Posts
    2

    Thanks!

    Ok, i think that makes sense...i'll try it and see. My only issue is i was trying not to alter the code too much, as i've just about understood how it works...the more i change the less i understand.

    I wanted to get to grips with the basic form i have and then try to add to it...the problem seems to me to be the part that refers to the sender's email. If i can sort that then i think the rest will work. I'm hopeful anyway!!

    Cheers
    Tom

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles