Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail() +submit, validate, error or thankyou

Status
Not open for further replies.

Curisco

Programmer
Feb 6, 2002
90
SE
Ok folks,
I don't think it's too much to ask but...

Warning: mail() expects at most 5 parameters, 20 given in /home/a/abss/ on line 54

oops!!
what happens then if i need to validate all field in the form (20 of them in fact)?

Please any help would be greatly appreciated.
The code:
Code:
<?php
/* recipients */
$to  = &quot;mpro02@hotmail.com&quot; . &quot;, &quot; ; 

/* additional headers */
$headers .= &quot;From: $sender_Ename <$sender_email>\r\n&quot;;
$headers .= &quot;Cc: archive@4lateruse.com\r\n&quot;;
$headers .= &quot;Bcc: marketing@dept.com\r\n&quot;; 

/* Subject */
$subject = &quot;Flyttstädning -house clean - Kontakt Form&quot;;

// the pages involved eg
$formurl = &quot;[URL unfurl="true"]http://www.abss.nu/_flyttForm.html&quot;[/URL] ;
$errorurl = &quot;[URL unfurl="true"]http://www.abss.nu/error.html&quot;[/URL] ;
$thankyouurl = &quot;[URL unfurl="true"]http://www.abss.nu/thankyou2.html&quot;[/URL] ;

/* users input */
$msg_Fakta = &quot;Faktauppgifter - Flytstädning \r\n&quot;;
$msg_FName  .= &quot;sender_F Name:    &quot;.$_POST['sender_Fname'].&quot;\n&quot;;//name of input fields
$msg_EName  .= &quot;sender_E Name:    &quot;.$_POST['sender_Ename'].&quot;\n&quot;;
$msg_Adress .= &quot;sender_Adress:      &quot;.$_POST['sender_Adress'].&quot;\n&quot;;
$msg_Pnum   .= &quot;sender_Pnum:      &quot;.$_POST['sender_Pnum'].&quot;\n&quot;;
$msg_Ort    .= &quot;sender_Ort:      &quot;.$_POST['sender_Ort'].&quot;\n&quot;;
$msg_TelNum .= &quot;sender_TelNum:      &quot;.$_POST['sender_TelNum'].&quot;\n&quot;;
$msg_Fax    .= &quot;sender_Fax:      &quot;.$_POST['sender_Fax'].&quot;\n&quot;;
$msg_Email  .= &quot;sender_Email:  &quot;.$_POST['sender_email'].&quot;\n\n&quot;;
$msg_kvm    .= &quot;lagenhet_kvm:      &quot;.$_POST['lagenhet_kvm'].&quot;\n&quot;;
$msg_rum    .= &quot;lagenhet_rum:      &quot;.$_POST['lagenhet_rum'].&quot;\n&quot;;
$msg_Toa    .= &quot;lagenhet_Toa:      &quot;.$_POST['lagenhet_Toa'].&quot;\n&quot;;
$msg_beds   .= &quot;lagenhet_beds:      &quot;.$_POST['lagenhet_beds'].&quot;\n&quot;;
$msg_kok    .= &quot;lagenhet_kok:      &quot;.$_POST['lagenhet_kok'].&quot;\n&quot;;
$msg_fonster .= &quot;lagenhet_fonster:      &quot;.$_POST['lagenhet_fonster'].&quot;\n\n&quot;;
$msg_Tid    .= &quot;flytt_Tid:      &quot;.$_POST['flytt_Tid'].&quot;\n\n&quot;;
$msg_ovriga .= &quot;flytt_ovriga:      &quot;.$_POST['flytt_ovriga'].&quot;\n&quot;;

$http_referrer = getenv( &quot;HTTP_REFERER&quot; );
if (!isset($_POST['sender_email'])) {
	header( &quot;Location: $formurl&quot; );
	exit ;
}
if 
   (empty($msg_Fakta) || empty($msg_FName) || empty($msg_EName) || empty($msg_Adress) || empty($msg_Pnum) || empty($msg_Ort) || empty($msg_TelNum) || empty($msg_Fax) || empty($msg_Email) || empty($msg_kvm) || empty($msg_rum) || empty($msg_Toa) || empty($msg_beds) || empty($msg_kok) || empty($msg_fonster) || empty($msg_Tid)) {
   header( &quot;Location: $errorurl&quot; );
   exit ;
}

mail( $to, $subject, $messageproper , $msg_EName, $msg_Adress, $msg_Pnum, $msg_Ort, $msg_TelNum, $msg_Fax, $msg_Email, $msg_kvm, $msg_rum, $msg_Toa, $msg_beds, $msg_kok, $msg_fonster, $msg_Tid, $msg_ovriga, $msg, $headers);
header( &quot;Location: $thankyouurl&quot; );
exit ;
?>
Thanks for your time.
/R

-------------------------------------
Laughing out loud every day,
keeps the doctor away....gotoAndPlay
-------------------------------------
 
The mail() function in the PHP manual says:
bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]])

I you need to condense all the variables starting $msg_ into one variable.
eg
mail( $to, $subject, $messageproper, headers, $msg_All)

What do you mean by validate the variables? Any validation needs to be done before entering the mail() function.

Out of interest, you said you were new to php in another thread. I highly recommend you goto php.net and download the php manual, if you haven't already.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top