problem with php mail() function (too many parms)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DMcN
    New Member
    • Oct 2007
    • 9

    problem with php mail() function (too many parms)

    Hi, please can someone help with a PHP error.

    I am trying to get a form on my website up and running with a PHP script. I've tested a PHP file on the server (and checked with my host) and all is OK.

    When I upload my script and form I get the error message below, does anyone know what I might me doing to cause this.

    I did comment out the bottom section because I don't think I actually need them, I was getting the error before doing that anyway. I've also replaced website/e-mail addresses.

    P.S. this is my first time using PHP.

    Thanks in advance.



    Error message:
    Warning: mail() expects at most 5 parameters, 6 given in /vhost/vhost4/m/o/n/myaddress.co.uk/www/iopost.php on line 22
    response=passed


    PHP Script:
    Code:
    <?php
    //create short variable names
    $fullName=$_POST['fullName'];
    $fullAddress=$_POST['fullAddress'];
    $postcode=$_POST['postcode'];
    $telNumber=$_POST['telNumber'];
    $emailAddress=$_POST['emailAddress'];
    $fullName =trim($fullName);
    $fullAddress =trim($fullAddress);
    $postcode=StripSlashes($postcode);
    $telNumber =StripSlashes($telNumber);
    $emailAddress =StripSlashes($emailAddress);
    
    //modify the next line with your own email address
    $toaddress='myaddress@mail.co.uk';
    
    mail($fullName,$fullAddress,$postcode,$telNumber,$emailAddress,"From: $fullName <$emailAddress >");
    
    //clear the variables
    //$fullName='';
    //$fullAddress='';
    //$postcode='';
    //$telNumber='';
    //$emailAddress='';
    //echo "response=passed";
    
    ?>
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    The format of the MAIL() command is
    Code:
    mail ( string $to, string $subject, string $message [, string $additional_headers [, string $additional_parameters]] ).
    You have too many parms, like the postal code or a telephone number are never specified as a mail() parameter.

    See THIS LINK TO PHP MAIL DOC

    Ronald

    Comment

    • DMcN
      New Member
      • Oct 2007
      • 9

      #3
      Thanks for the speedy reply Ronald.

      Does this mean if I delete the code:

      Code:
      $postcode,$telNumber,$  emailAddress,
      I will lose that particular info from my form or does it get picked up from the top section, or should I format it in another way.

      Thanks again.

      Comment

      Working...