The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
Mail form problem
Discuss Mail form problem in the PHP Development forum on Dev Shed. Mail form problem PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 11th, 2000, 02:16 PM
|
|
Junior Member
|
|
Join Date: Jan 2000
Location: Ambler, PA, USA
Posts: 5
Time spent in forums: < 1 sec
Reputation 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
|

January 11th, 2000, 02:30 PM
|
|
Apprentice Deity
|
|
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237

Time spent in forums: 4 m 8 sec
Reputation Power: 17
|
|
|
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.
|

January 11th, 2000, 02:45 PM
|
|
Junior Member
|
|
Join Date: Jan 2000
Location: Ambler, PA, USA
Posts: 5
Time spent in forums: < 1 sec
Reputation 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
|

January 11th, 2000, 02:54 PM
|
|
Apprentice Deity
|
|
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237

Time spent in forums: 4 m 8 sec
Reputation Power: 17
|
|
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 
|

January 12th, 2000, 09:19 AM
|
|
Junior Member
|
|
Join Date: Jan 2000
Location: Ambler, PA, USA
Posts: 5
Time spent in forums: < 1 sec
Reputation 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
|

January 12th, 2000, 09:53 AM
|
|
Apprentice Deity
|
|
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237

Time spent in forums: 4 m 8 sec
Reputation Power: 17
|
|
|
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);
|

January 14th, 2000, 11:22 AM
|
|
Contributing User
|
|
Join Date: Apr 1999
Location: London
Posts: 110
Time spent in forums: 22 m 26 sec
Reputation 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
|

January 14th, 2000, 11:27 AM
|
|
Apprentice Deity
|
|
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237

Time spent in forums: 4 m 8 sec
Reputation Power: 17
|
|
|
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...
|

January 14th, 2000, 11:46 AM
|
|
Contributing User
|
|
Join Date: Apr 1999
Location: London
Posts: 110
Time spent in forums: 22 m 26 sec
Reputation Power: 0
|
|
sorry didn't spot that bit 
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|