Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 11-03-2007, 06:54 PM
Corporal
 
Join Date: Nov 2006
Posts: 15
Default Mail form/ PHP problems - Help!

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>&nbsp;</td>
<td>&nbsp;</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>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Your message * </td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2"><textarea name="message" cols="45" rows="5" id="Your message"></textarea></td>
</tr>
<tr>
<td colspan="2">&nbsp;</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





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 11-03-2007, 07:28 PM
Watdaflip's Avatar
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,640
Default Re: Mail form/ PHP problems - Help!

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 11-03-2007, 08:22 PM
Corporal
 
Join Date: Nov 2006
Posts: 15
Default Re: Mail form/ PHP problems - Help!

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...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 11-03-2007, 11:45 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,033
Default Re: Mail form/ PHP problems - Help!

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!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 11-04-2007, 12:48 AM
Corporal
 
Join Date: Nov 2006
Posts: 15
Default Re: Mail form/ PHP problems - Help!

Thanks a lot, Navaldesign!

It works perfectly. I really appreciate your help!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 02:12 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2007 VodaHost.com - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55