email error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Corey

    email error

    Hello,

    I have created a form that is sent via email and am getting the
    following error:

    Warning: mail() expects at most 5 parameters, 14 given in
    /home/sites/site324/web/order_form_test 1.php on line 277


    What does this mean and how do I solve it?

    Thanks,


    Corey
  • Ruben van Engelenburg

    #2
    Re: email error

    Corey wrote:[color=blue]
    > Hello,
    >
    > I have created a form that is sent via email and am getting the
    > following error:
    >
    > Warning: mail() expects at most 5 parameters, 14 given in
    > /home/sites/site324/web/order_form_test 1.php on line 277
    >
    >
    > What does this mean and how do I solve it?
    >
    > Thanks,
    >
    >
    > Corey[/color]

    Exactly what it says: You pass 14 parameters to the mail() function,
    where 5 is the maximum number of parameters for the mail function. It
    needs 3 parameters at least and max 5.
    See: http://nl2.php.net/manual/en/ref.mail.php

    Regards,
    Ruben.

    Comment

    • Corey

      #3
      Re: email error

      Joshua Ghiloni <jdg11@SPAM.ME. AND.DIE.cwru.ed u> wrote in message news:<bekp4h$kv 5$1@eeyore.INS. cwru.edu>...[color=blue]
      > Corey wrote:[color=green]
      > > Hello,
      > >
      > > I have created a form that is sent via email and am getting the
      > > following error:
      > >
      > > Warning: mail() expects at most 5 parameters, 14 given in
      > > /home/sites/site324/web/order_form_test 1.php on line 277
      > >
      > >
      > > What does this mean and how do I solve it?
      > >
      > > Thanks,
      > >
      > >
      > > Corey[/color]
      > My guess is that you are passing each header as a parameter. All
      > additional headers are to be in one field.[/color]

      Sorry still confused--Here is the code I am referring to.

      {
      $sendto = "cgooley@cinci. rr.com";
      $firstname = $_POST['firstname'];
      $lastname = $_POST['lastname'];
      $address = $_POST['address'];
      $city = $_POST['city'];
      $state = $_POST['state'];
      $zipcode = $_POST['zipcode'];
      $phone = $_POST['phone'];
      $image1 = $_POST['image1'];
      $size1 = $_POST['size1'];
      $quantity1 = $_POST['quantity1'];
      $image2 = $_POST['image2'];
      $size2 = $_POST['size2'];
      $quantity2 = $_POST['quantity2'];
      $comments = $_POST['comments'];

      mail( "$sendto",
      "First name: $firstname", "Last name: $lastname", "City: $city",
      "State: $state", "Zip Code: $zipcode", "Phone: $phone",
      "Image1: $image1", "Size1: $size1", "quantity1: $quantity1",
      "Image 2: $image2", "Size2: $size2", "quantity2: $quantity2",
      "$comments" );
      }

      Comment

      • Joshua Ghiloni

        #4
        Re: email error

        Corey wrote:[color=blue]
        > Joshua Ghiloni <jdg11@SPAM.ME. AND.DIE.cwru.ed u> wrote in message news:<bekp4h$kv 5$1@eeyore.INS. cwru.edu>...
        >[color=green]
        >>Corey wrote:
        >>[color=darkred]
        >>>Hello,
        >>>
        >>>I have created a form that is sent via email and am getting the
        >>>following error:
        >>>
        >>>Warning: mail() expects at most 5 parameters, 14 given in
        >>>/home/sites/site324/web/order_form_test 1.php on line 277
        >>>
        >>>
        >>>What does this mean and how do I solve it?
        >>>
        >>>Thanks,
        >>>
        >>>
        >>>Corey[/color]
        >>
        >>My guess is that you are passing each header as a parameter. All
        >>additional headers are to be in one field.[/color]
        >
        >
        > Sorry still confused--Here is the code I am referring to.
        >
        > {
        > $sendto = "cgooley@cinci. rr.com";
        > $firstname = $_POST['firstname'];
        > $lastname = $_POST['lastname'];
        > $address = $_POST['address'];
        > $city = $_POST['city'];
        > $state = $_POST['state'];
        > $zipcode = $_POST['zipcode'];
        > $phone = $_POST['phone'];
        > $image1 = $_POST['image1'];
        > $size1 = $_POST['size1'];
        > $quantity1 = $_POST['quantity1'];
        > $image2 = $_POST['image2'];
        > $size2 = $_POST['size2'];
        > $quantity2 = $_POST['quantity2'];
        > $comments = $_POST['comments'];
        >
        > mail( "$sendto",
        > "First name: $firstname", "Last name: $lastname", "City: $city",
        > "State: $state", "Zip Code: $zipcode", "Phone: $phone",
        > "Image1: $image1", "Size1: $size1", "quantity1: $quantity1",
        > "Image 2: $image2", "Size2: $size2", "quantity2: $quantity2",
        > "$comments" );
        > }[/color]


        Change that to
        mail ("$sendto",
        "insert subject here", # <--- The second parameter is the #
        subject, and is required.
        "First name: $firstname\n" .
        "Last name: $lastname\n" .
        ...
        "$comments" );

        You see, when you put the commas between each key-value pair--what I
        assume to be discrete lines of the email--mail() is reading each them as
        parameters to the function. Instead, the entire body needs to be one
        long string. The . operator accomplishes this. It is necessary, but
        makes it a bit more readable.

        HTH
        Josh

        Comment

        Working...