PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 11th, 2000, 02:16 PM
DSchnell DSchnell is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Ambler, PA, USA
Posts: 5 DSchnell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old January 11th, 2000, 02:30 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to 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.

Reply With Quote
  #3  
Old January 11th, 2000, 02:45 PM
DSchnell DSchnell is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Ambler, PA, USA
Posts: 5 DSchnell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #4  
Old January 11th, 2000, 02:54 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
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

Reply With Quote
  #5  
Old January 12th, 2000, 09:19 AM
DSchnell DSchnell is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Ambler, PA, USA
Posts: 5 DSchnell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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


Reply With Quote
  #6  
Old January 12th, 2000, 09:53 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
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);



Reply With Quote
  #7  
Old January 14th, 2000, 11:22 AM
timbo timbo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 1999
Location: London
Posts: 110 timbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #8  
Old January 14th, 2000, 11:27 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
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...

Reply With Quote
  #9  
Old January 14th, 2000, 11:46 AM
timbo timbo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 1999
Location: London
Posts: 110 timbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 26 sec
Reputation Power: 0
sorry didn't spot that bit

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Mail form problem

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap