Welcome to TalkGraphics.com
Results 1 to 9 of 9
  1. #1

    Default Email form to more than one email address

    Sorry if this is a silly question but being a site virgin I have worn out the search button and still can't find a solution. What I need in WD is an email form that has a drop down menu so that the sender can choose which person(connected with the site) he wishes to email to. So the form would have the usual entry boxes plus a selection box (not cadburys!) which could be populated with names linked to email addresses for the message to go to. Hopefully there is a genius who can help.

  2. #2
    Join Date
    Aug 2008
    Location
    Canton, GA
    Posts
    666

    Default Re: Email form to more than one email address

    You need to use a placeholder. In that, choose to "reaplace with html code" and put in some form code, like this:

    Code:
    <form action="signup.php" method="post">
    <table summary="signup form">
    <tr><td>Your Name:</td><td><input type="text" name="name" size="50" /></td></tr>
    <tr><td>Your Email address:</td><td><input type="text" name="email" size="50" /></td></tr>
    <tr><td>Who do you want to Contact?</td>
    
    <td>
    <select name="mydropdown">
    <option value="wilma@company.com">Wilma Flintstone</option>
    <option value="barney@company.com">Barney Rubble</option>
    <option value="fred@company.com">Fred Flintstone</option>
    </select>
    </td>
    
    <tr>
    <td></td>
    <td>
    <input type="submit" value="Sign Up">
    </td>
    </tr>
    </table>
    </form>
    Then, you would have a php file called signup.php (the ACTION of the form) which would then grab the POST variables and use the mail functions to fill the appropriate values as needed. There are a lot of freely available php scripts to handle this part.

    Does that help?

  3. #3

    Info Re: Email form to more than one email address

    Slavelle, wow that was quick thanks a lot.Looks just what I need. Just placed it in a placeholder and it works great. As I said a virgin on site production so I assume that I can change the html to place the variable email address section above the input for email and name. I also need an input box for the message in the email and I assume I can change wording button to submit or send. Now off to find the php code to make it work. (any hints?)

  4. #4
    Join Date
    Aug 2008
    Location
    Canton, GA
    Posts
    666

    Default Re: Email form to more than one email address

    This is where I started. This little wizard will basically create the required php code. After I did this once, I've just taken the code apart and used the parts I needed. This is a fairly short and easy to understand script.

    Hope this helps:
    http://www.thesitewizard.com/wizards/feedbackform.shtml

  5. #5

    Red face Re: Email form to more than one email address

    Slavelle, thanks or the html and I have juggled it around to get it how I wanted and in the right order and it looks as if it will do just nicely. I visited the site(and others) re. the php code but despite hours of trial I cannot get the code right to make the mailer operate.

    I know it's cheeky but any pointers as to what I need to do to get your html to work? I'm sure once I get the basics started I can go in the right direction.

    Cheers

  6. #6
    Join Date
    Feb 2001
    Location
    Surrey, BC, Canada
    Posts
    2,379

    Default Re: Email form to more than one email address

    Hi,
    Here is a xara file that I have, can't remember who done the original post (old age).
    It has instructions on how to modify it, on the $to= "email address in red change to the e-mails you wish sparated by a comma and change the forward flag to 1.
    I think that may do the trick.
    Just my idea I haven't tested it as per my changes.
    contactform[Jim].web[1].xar
    Hope this helps
    JimM

  7. #7

    Default Re: Email form to more than one email address

    Thanks Scotty, I have looked at that one already but cannot find any way of adapting it to give a drop down selector box. I want to give the visitor the chance to email any one of 15 people by selecting from a drop down menu then entering their name, email and comments.
    Slavelles html gives the layout ok but I can't work out how to get a php to accept the different email recipient from the html selection form and send it. I keep getting an Error 405 Method Not Allowed
    The requested method POST is not allowed for URL /feedback.php


    I entered the "mydropdown" as the variable selected in the email tosection of the php but it doesn't seem to want to work

    Fustration abounds, but hey! that what you buy a computer for!

    This is what I mean
    http://www.cradleyparishcouncil.org.uk/councillors.htm
    and
    http://www.cradleyparishcouncil.org.uk/contact%20us.htm
    Last edited by mentorman; 19 February 2010 at 06:10 PM. Reason: missed a line of info

  8. #8
    Join Date
    Aug 2008
    Location
    Canton, GA
    Posts
    666

    Default Re: Email form to more than one email address

    In the php, make a line that says something like this:

    $mydropdown = $_POST('mydropdown');

    Then, wherever the email address is being used for the mailing, sub it with $mydropdown. If you want to make it clearer, call it something like $SelectedEmailAddress or something. Doesn't matter, as long as the $_POST matches what the NAME field of the sending form has in it.

    Does that help?

  9. #9

    Default Re: Email form to more than one email address

    It looks like this is a two part process...?
    I am trying to follow the threads and place all code to get this to work in one place. currently this is not working.
    (this code is not mine, and was coppied from others on this site) thank you

    Email Form 1:2
    mailer.php should be uploaded to the same location as index.htm

    1) Copy and paste code below to a notepad file called mailer.txt and rename to mailer.php
    Text highlighted in red may be edited to suit


    Code:
     
    <?PHP 
    $to = "youremail@wherever.com"; 
    $subject = "Contact Form response";
    $headers = "From: Form Mailer";
    $forward = 0;”Changing this flag from 0 to 1”
    $location = "";”change this to “Thankyou.htm” a thanks for e-mailing page”
    $date = date ("l, F jS, Y"); 
    $time = date ("h:i A"); 
     
    $msg = "Below is a message from your contact form submitted on $date at $time.\n\n"; 
     
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        foreach ($_POST as $key => $value) { 
            $msg .= ucfirst ($key) ." : ". $value . "\n"; 
        }
    }
    else {
        foreach ($_GET as $key => $value) { 
            $msg .= ucfirst ($key) ." : ". $value . "\n"; 
        }
    }
     
    mail($to, $subject, $msg, $headers); 
    if ($forward == 1) { 
    header ("Location:$location"); 
    } 
    else { 
    echo "Thank you for contacting us. We will get back to you as soon as possible."; 
    } 
     
    ?>

    Email Form 2:2
    2) Place this in a placeholder:


    Code:
     
    <font face=verdana size=1>
    Contact Us:<br>
    <form action="mailer.php" method="post"> 
    Your Name: <input type="text" name="test"><br> 
    Your Email: <input type="text" name="email"><br><br> 
    Your Message:<br> <textarea name="message" rows="8" cols="35"></textarea><br> 
    <input type="submit" name="submit" value="Submit"> 
    </form>
    </font>
    sadicus - Win10 ● nvidia 32GB ● XDP17

 

 

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
  •