Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Having option of email recipient in form mail ?

  1. #11
    Join Date
    Jul 2007
    Location
    New Zealand
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default

    Hey,
    I added your ) but then I got this:

    Parse error: syntax error, unexpected '}' in /home/www/ravenouspathogen.com/contact.php on line 83
    So I tried taking that out knowing full well the } was part of the format of the script code (like css) and then the page reloads and doesn't send a thing, so I put it back.

  2. #12
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I don't see anything wrong with that. Has the line I wrote, as posted in my previous post, become line 83?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #13
    Join Date
    Jul 2007
    Location
    New Zealand
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default

    I've repasted the code, including the form variables from the html page as I cannot see what the problem is and I will highlight what is 'line 83' for you. Maybe you can see it.


    <form action="http://www.ravenouspathogen.com/contact.php" method="post">
    <table border="0" bgcolor="#000000" cellspacing="5">
    <tr><td><font face="garamond">Select Recipient:</font></td><td><select name="mailto" size="1">
    <option value="1">Artist</option>
    <option value="2">Webmistress</option>
    </select></td></tr>
    <tr><td><font face="garamond">Name:</td><td><input type="text" size="30" name="name"></td></tr>
    <tr><td><font face="garamond">Email address:</td><td><input type="text" size="30" name="email"></td></tr>
    <tr><td valign="top"><font face="garamond">Enquiry:</td><td><textarea name="comments" rows="10" cols="40"></textarea></td></tr>
    <tr><td>&nbsp;</td><td><input type="submit" value="Send" style="color: black; font-family: verdana; font-size: 10pt; font-weight: bold; background-color: white;" class="send"></td></tr>
    </table>
    </form>
    <?php

    // ------------- CONFIGURABLE SECTION ------------------------

    // $mailto - set to the email address you want the form
    // sent to, eg
    //$mailto = "info@someplace.com" ;

    $mailto = $_POST['mailto'];

    // $subject - set to the Subject line of the email, eg
    //$subject = "Feedback Form" ;

    $subject = "Website Enquiry" ;

    // the pages to be displayed, eg
    //$formurl = "http://www.example.com/feedback.html" ;
    //$errorurl = "http://www.example.com/error.html" ;
    //$thankyouurl = "http://www.example.com/thankyou.html" ;

    $formurl = "http://www.ravenouspathogen.com/contact.html" ;
    $errorurl = "http://www.ravenouspathogen.com/error.html" ;
    $thankyouurl = "http://www.ravenouspathogen.com/thankyou.html" ;

    $uself = 0;

    // -------------------- END OF CONFIGURABLE SECTION ---------------

    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
    $name = $_POST['name'] ;
    $fromemail = "From: info@someplace.com";
    $email = $_POST['email'] ;
    $comments = $_POST['comments'] ;
    $http_referrer = getenv( "HTTP_REFERER" );

    if (!isset($_POST['mailto'])===1) { $mailto = 'info@someplace.com'; } else { $mailto = 'webmistress@someplace.com'; }

    header( "Location: $formurl" );
    exit ;
    }
    if (empty($name) || empty($email) || empty($comments)) {
    header( "Location: $errorurl" );
    exit ;
    }
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    exit ;
    }

    if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
    }

    $messageproper =

    "This message was sent from:\n" .
    "$http_referrer\n" .
    "------------------------------------------------------------\n" .
    "Name of sender: $name\n" .
    "Email of sender: $email\n" .
    "------------------------- COMMENTS -------------------------\n\n" .
    $comments .
    "\n\n------------------------------------------------------------\n" ;

    mail($mailto, $subject, $messageproper,
    "$fromemail", $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.08" );
    header( "Location: $thankyouurl" );
    exit ;

    ?>
    Oh and Meri Kirihemete - (Maori for Merry Christmas)
    Last edited by Eternal_Howl; 12-25-2007 at 07:35 AM.

  4. #14
    Join Date
    Jul 2007
    Location
    New Zealand
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default

    Still no joy. I may have to put two forms on the site.

Bookmarks

Posting Permissions

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