wowcrofty Posted July 23, 2010 Share Posted July 23, 2010 I am hoping someone will be kind enough to help me with this problem. I am using an HTML form to collect data and then passing it to a php file with the mail function to send a message. However, whenever I click the Submit button on the HTML and execute the PHP code, I receive the error: Warning: mail() expects at most 5 parameters, 6 given in D:\Hosting\4872190\html\forum.php on line 8. Included below are the two files for your reference. My HTML form (forum_verification.htm) <head> <style type="text/css"> .style1 { font-family: Arial; } .style2 { text-align: center; } .style30 { vertical-align: middle; } .style32 { font-family: Arial; text-align: center; } .style33 { text-align: center; font-family: Arial, Helvetica, sans-serif; font-weight: bold; } </style> <title>Forum Registration Verification</title> <script type="text/javascript"> <!-- function FP_swapImg() {//v1.0 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length; n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm; elm.$src=elm.src; elm.src=args[n+1]; } } } function FP_preloadImgs() {//v1.0 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array(); for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; } } function FP_getObjectByID(id,o) {//v1.0 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id); else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el; if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c) for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; } f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements; for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } } return null; } // --> </script> </head> <body style="background-color: #9E9A61; background-image: url('background.jpg');" onload="FP_preloadImgs(/*url*/'button55.gif',/*url*/'button56.gif')"> <div class="style2"> <table style="width: 100%" cellspacing="4" align="center"> <tr> <td class="style32" style="width: 342px"> <img alt="American Flag" src="American%20Flag.gif" width="161" height="90" /></td> <td class="style1" style="width: 342px"> <center><img alt="Crest" src="Honor%20Crest.gif" width="125" height="122" class="style30" /></center></td> <td class="style32" style="width: 342px"> <img alt="PA Flag" src="PA%20Flag.gif" width="152" height="96" />.</td> </tr> </table> <br /></div> <form method="post" action="forum.php"> <div class="style2"> <span class="style1">Name: <input name="name" type="text" style="width: 182px"><br> <br> Registered User Name: <input name="reguser" type="text" style="width: 180px; height: 20px"><br> <br> Email Address: <input name="email" type="text" style="width: 180px; height: 20px"><br> <br> <br> </span> <br> <input type="submit" value="Submit" name="submit"> <input type="reset" value="Clear Form" name="clear"> </div> </form> <p class="style33"><br> THANK YOU FOR TAKING THE TIME TO SEND THE INFORMATION!</p> <p class="style33"> </p> <p class="style2"><a href="javascript:window.opener='x';window.close();"> <img style="border: 0" id="img1" src="button57.gif" height="30" width="150" alt="Close Window" onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'button55.gif')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'button57.gif')" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'button56.gif')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'button55.gif')" fp-style="fp-btn: Metal Capsule 2; fp-font: Arial, Helvetica, sans-serif; fp-font-size: 12; fp-transparent: 1" fp-title="Close Window" /></a></p> </body> My PHP file (forum.php <?php $to = "[email protected]"; $subject = "Forum User Name Identification"; $name= $_REQUEST['name'] ; $reguser = $_REQUEST['reguser'] ; $email = $_REQUEST['email'] ; $headers = "From: $name" ; $sent = mail($to, $subject, $name, $reguser, $email, $headers) ; if($sent) {print "Your information has been submitted. Thank you very much!"; } else {print "There was a problem sending your information. Please try again."; } ?> Thank you in advance for your assistance! Link to comment https://forums.phpfreaks.com/topic/208626-php-mail-function-please-help/ Share on other sites More sharing options...
Pikachu2000 Posted July 23, 2010 Share Posted July 23, 2010 The error message is pretty self-explanatory. like it says in the manual: mail(to, subject, body, headers, [optional 5th parameter]) Link to comment https://forums.phpfreaks.com/topic/208626-php-mail-function-please-help/#findComment-1089944 Share on other sites More sharing options...
Alex Posted July 23, 2010 Share Posted July 23, 2010 It's pretty self-explanatory; mail takes in 5 parameters at most, and you're supplying it with 6. Check out the manual on mail() for instructions on how to use it. Link to comment https://forums.phpfreaks.com/topic/208626-php-mail-function-please-help/#findComment-1089947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.