|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
<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 |
|
#4
|
|||
|
|||
|
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 ![]() |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
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); |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
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... |
|
#9
|
|||
|
|||
|
sorry didn't spot that bit
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > Mail form problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|