+ Reply to Thread
Results 1 to 5 of 5

Thread: Mail form/ PHP problems - Help!
      
   

  1. #1
    dmitry_makarov is offline 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






  2. #2
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    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

  3. #3
    dmitry_makarov is offline 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...

  4. #4
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    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!


  5. #5
    dmitry_makarov is offline 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!!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

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