#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Ambler, PA, USA
    Posts
    5
    Rep Power
    0
    Hello,
    Maybe you can help me. I am new to PHP and trying to figure out why I am getting the following error.

    ***************************************
    Warning: Wrong parameter count for mail() in /usr/local/etc/httpd/sites/ridgeauto.com/htdocs/postman.php3 on line 3
    sent=done

    ****************************************

    I created a form in Macromedia Flash which tries to send the results of a form via a php3 file to us, but there seems to be a problem with the code.
    Beneath is the actual code in my php3 file.
    Thanks in advance for any help!

    ****************************************

    <?php
    mail($recipient, $CustName, $email, $homephone, $workphone, $license, $year, $make, $model, $safetycheck, $EmCheck, $OilCheck, $TransCheck, $TuneCheck, $CECheck, $AlignCheck, $TiresCheck, $BrakesCheck, $LeakCheck, $NoiseCheck, $BeltsCheck,
    "From:".$email."nReply-To:".$CustName);
    echo("sent=done");
    ?>

    **************************************

    Don Schnell
    Senior Production Engineer
    Tools For Education, Inc
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    mail() can have at most 4 parameters. You need to have the variables you want sent in the body of the message, which is one parameter.

    Parameters are

    mail("To address","subject","body","optional additional headers");

    In your code it does not appear you have a subject and all the variables from $CustName to $BeltsCheck need to be in the body.

    How you format that is up to you.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Ambler, PA, USA
    Posts
    5
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by rod k:
    mail() can have at most 4 parameters. You need to have the variables you want sent in the body of the message, which is one parameter.

    Parameters are

    mail("To address","subject","body","optional additional headers");

    In your code it does not appear you have a subject and all the variables from $CustName to $BeltsCheck need to be in the body.

    How you format that is up to you.
    [/quote]


    Rod,
    Thanks for the help!
    Do you know of any examples (or where to find them) of placing the variables in the body?

    Don
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You can do something like this:

    $body="varname = $varnamen"
    $body.="varname2 = $varname2n"
    $body.="varname3 = $varname3n"

    etc.

    Note, this would be much easier if you use an array to hold your form variables
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Ambler, PA, USA
    Posts
    5
    Rep Power
    0
    I re-wrote the php3 file in the following manner, but I still am receiving the error of wrong parameter count. Do I have the body variable set correctly?

    <?php
    mail($recipient, $subject,
    $body="CustName = $CustNamen",
    $body.="email = $emailn",
    $body.="homephone = $homephonen",
    $body.="workphone = $workphonen",
    $body.="license = $licensen",
    $body.="year = $yearn",
    $body.="make = $maken",
    $body.="model = $modeln",
    $body.="safetycheck = $safetycheckn",
    $body.="EmCheck = $EmCheckn",
    $body.="OilCheck = $OilCheckn",
    $body.="TransCheck = $TransCheckn",
    $body.="TuneCheck = $TuneCheckn",
    $body.="CECheck = $CECheckn",
    $body.="AlignCheck = $AlignCheckn",
    $body.="TiresCheck = $TiresCheckn",
    $body.="BrakesCheck = $BrakesCheckn",
    $body.="LeakCheck = $LeakCheckn",
    $body.="NoiseCheck = $NoiseCheckn",
    $body.="BeltsCheck = $BeltsCheck");
    echo("sent=done");
    ?>

    TIA for any help

  10. #6
  11. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    No, you don't. You have to set the variable BEFORE you call mail:

    $body="CustName = $CustNamen",
    $body.="email = $emailn",
    $body.="homephone = $homephonen",
    $body.="workphone = $workphonen",
    $body.="license = $licensen",
    $body.="year = $yearn",
    $body.="make = $maken",
    $body.="model = $modeln",
    $body.="safetycheck = $safetycheckn",
    $body.="EmCheck = $EmCheckn",
    $body.="OilCheck = $OilCheckn",
    $body.="TransCheck = $TransCheckn",
    $body.="TuneCheck = $TuneCheckn",
    $body.="CECheck = $CECheckn",
    $body.="AlignCheck = $AlignCheckn",
    $body.="BrakesCheck = $BrakesCheckn",
    $body.="LeakCheck = $LeakCheckn",
    $body.="NoiseCheck = $NoiseCheckn",
    $body.="BeltsCheck = $BeltsCheck");

    Then call mail():

    mail($recipient,$subject,$body);


  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 1999
    Location
    London
    Posts
    110
    Rep Power
    0
    you can have as many entries as you like in the mail function, this is one I am using at the mo for a loan application I am doing for a company...

    mail("example@example.com example2@example2.com","Application",
    "Title :$title
    nForename :$name
    nSurname :$surname
    nDOB :$day-$month-$year
    nAddress :$address1
    nAddress :$address2
    nAddress :$address3
    nPostcode :$postcode
    nhomephoneSTD :$homephoneSTD-$homephoneno
    nworkphoneSTD :$workphoneSTD-:$workphoneno
    nworkphoneEXT :$workphoneEXT
    nApplication source code :$src
    nYears at address :$leny (yrs)$lenm (mths)
    nOld address1 :$oldaddress1
    nOld address2 :$oldaddress2
    nOld address3 :$oldaddress3
    nOld address4 :$oldaddress4
    nOld postcode :$oldpostcode
    nYears at previous :$oldlivedthereY
    nMths at previous :$oldlivedthereM
    nprev surname :$prevsurname
    nOwner ? :$owner
    nfurnished :$furnished
    npropertyvalue :$propertyvalue
    nutstandingmortgage :$outstandingmortgage
    nmothersmaiden :$mothersmaiden
    nMarital status :$status
    nNumber of kids :$kidsnumber
    nemail :$email
    noccupation :$occupation
    nbusinessnature :$businessnature
    nemployername :$employername
    nemployeraddress1 :$employeraddress1
    nemployeraddress2 :$employeraddress2
    nemployeraddress3 :$employeraddress3
    nemployeraddress4 :$employeraddress4
    nemployerpostcode :$employerpostcode
    ntimeemployedY :$timeemployedY
    ntimeemployedM :$timeemployedM
    napplicantincome :$applicantincome
    npartnertitle :$partnertitle
    npartnerfirstname :$partnerfirstname
    nPartner Last Name :$Partner Last Name
    npartnerDOBd :$partnerDOBd
    npartnerDOBm :$partnerDOBm
    npartnerDOBy :$partnerDOBy
    npartneroccupation :$partneroccupation
    npartnerworkedthereY :$partnerworkedthereY
    npartnerworkedthereM :$partnerworkedthereM
    npartnerincome :$partnerincome
    nloanamountrqd :$loanamountrqd
    ntimeperiod :$timeperiod
    nloanpurpose :$loanpurpose
    ninsure :$insure
    nexpendmortgage :$expendmortgage
    nexpendcounciltax :$expendcounciltax
    nexpendinsurance :$expendinsura
    nexpendcredit :$expendcredit
    ntotalmonthlyexpenditure:$totalmonthl
    nbankname :$bankname
    nbankaddress1 :$bankaddress1
    nbankaddress2 :$bankaddress2
    nbankaddress3 :$bankaddress3
    nbankaddress4 :$bankaddress4
    nbankpostcode :$bankpostcode
    nbankaccount :$bankaccount
    nsortcode1 :$sortcode1
    nsortcode2 :$sortcode2
    nsortcode3 :$sortcode3
    ntimewithbankY :$timewithbankY
    ntimewithbankM :$timewithbankM
    ncreditcard :$creditcard
    nchequecard :$chequecard
    nccvisa :$ccvisa
    nccamex :$ccamex
    nccmastercard :$ccmastercard
    nccdiners :$ccdiners
    nccswitchdelta :$ccswitchdelta
    nccother :$ccother
    nccothertype :$ccothertype
    nchargecard* :$chargecard*
    nAccount number :$Accountnumber
    nnodirectmail :$nodirectmail
    nconfirmation :$confirmation
    ",
    "From: stick whatever you want in here or their email");

    it doesnt matter how many fields you have so long as they are contained within their sections

    ------------------
    cheers
  14. #8
  15. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Yes, you can do that, but that's not what DSchnell was doing. Read the post again.

    What I said was that you can't have more than 4 arguments. You are passing 4, albeit damn near impossible to read...
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 1999
    Location
    London
    Posts
    110
    Rep Power
    0
    sorry didn't spot that bit

Similar Threads

  1. form submit problem
    By nobertos in forum PHP Development
    Replies: 1
    Last Post: February 17th, 2004, 03:45 AM
  2. Replies: 1
    Last Post: February 8th, 2004, 01:59 PM
  3. Help with script
    By akastarlight in forum Perl Programming
    Replies: 1
    Last Post: February 6th, 2004, 06:55 AM
  4. ASP Mail, toggle to send form to different locations
    By needafixx in forum ASP Programming
    Replies: 3
    Last Post: February 4th, 2004, 09:47 AM
  5. UPDATE problem in Edit form
    By CLuver in forum PHP Development
    Replies: 3
    Last Post: January 27th, 2004, 10:38 PM

IMN logo majestic logo threadwatch logo seochat tools logo