![]() |
|
| |||||||
| Notices |
| mySQL & PHP Discussions, information and help with mySQL and PHP. |
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| Hi, I'm rebuilding my website (www.yourtradeagent.com) with Dreamweaver 8 My form page adress is: www.yourtradeagent.com/contact.html I have problems with it. When I test it, it says "Warning: mail() expects at most 5 parameters, 9 given in /home/xncaaer/public_html/contact.php on line 12" Here is my code contact.html (just the form) <form action="contact.php" method="post" name="contact_form" id="contact_form"> <table width="414" border="0" cellpadding="0" cellspacing="0" class="table1contact"> <tr> <td height="26">Your name * </td> <td><input name="name" type="text" id="Your name" size="35" /></td> </tr> <tr> <td height="28">Your company </td> <td><input name="company" type="text" id="Company" size="35" /></td> </tr> <tr> <td>Industry </td> <td><select name="industry"> <option>Consumer Products</option> </select> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td height="27">Your e-mail * </td> <td><input name="email" type="text" id="Your e-mail" size="35" /></td> </tr> <tr> <td height="26">Confirm your e-mail * </td> <td><input name="confemail" type="text" id="Confirm your e-mail" size="35" /></td> </tr> <tr> <td height="26">Your phone number </td> <td><input name="phone" type="text" id="phone" size="35" /></td> </tr> <tr> <td width="149">Preffered language </td> <td width="265"><select name="lang" id="lang"> <option>English</option> <option>Español</option> <option>Fraçais</option> <option>Русский</option> </select> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Your message * </td> <td> </td> </tr> <tr> <td colspan="2"><textarea name="message" cols="45" rows="5" id="Your message"></textarea></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"><input name="submit" type="submit" onclick="MM_validateForm('Your name','','R','Your e-mail','','RisEmail','Confirm your e-mail','','RisEmail','Your message','','R');return document.MM_returnValue" value=" Submit " /> <input name="Reset" type="reset" id="Reset" value=" Reset " /></td> </tr> </table> </form> contact.php <?php if (isset($_POST['submit'])) $recipient = "info@yourtradeagent.com"; $name = $_POST['name']; $company = $_POST['company']; $industry = $_POST['industry']; $email = $_POST['email']; $confemail = $_POST['confemail']; $phone = $_POST['phone']; $lang = $_POST['lang']; $message = $_POST['message']; mail($recipient, $name, $company, $industry, $email, $confemail, $phone, $lang, $message); ?> It's a simple script but I still can't make it work well. Do I have to set up testing server info in Dreamweaver, for now I've just set up the remote info (ftp, etc.). Could that be the problem? Sorry if it obvious. Completely new to php. Thank you |
|
#2
| ||||
| ||||
| The problem is you are not using the mail function correctly It should be mail($to, $subject, $message, $headers); You have mail($recipient, $name, $company, $industry, $email, $confemail, $phone, $lang, $message); You need to make that something like $message = "Message Body: Name: ".$name." Company: ".$company." etc.. "; mail($recipient, $subject, $message, 'From: '.$email);
__________________ Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#3
| |||
| |||
| Thank you for your prompt reply! I've done it again, but there is still something wrong with the message variable: It says Parse error: syntax error, unexpected T_VARIABLE in /home/xncaaer/public_html/contact.php on line 5 <?php if (isset($_POST['submit'])) $to = "info@yourtradeagent.com"; $subject = "Contact Form Feedback" $message = "Message Body: Name: ".$name." Company: ".$company." Industry: ".$industry." Email: ".$email." Confemail: ".$confemail." Phone: ".phone." Language: ".lang." Message: ".message." "; mail($to, $subject, $message); ?> What could it be? Thank you... |
|
#4
| ||||
| ||||
| Make the 5th line: $message = "Message Body:"; However, since this is not the only problem here, i suggest that you use the following code: <?PHP $mailto = "youremail@yourdomain.com"; $email = $HTTP_POST_VARS['email']; if ($email == "") { $email = $mailto; } $mailsubj = "Type your mail subject here"; $mailhead = "From: $email\n"; reset ($HTTP_POST_VARS); $mailbody = "Values submitted from web site form :\n"; while (list ($key, $val) = each ($HTTP_POST_VARS)) { if ($key!="submit") { $mailbody .= "$key : $val\n"; } } mail($mailto, $mailsubj, $mailbody, $mailhead); ?>
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |