The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 3 of 3

Thread: Send to one email address or another

  1. #1

    Send to one email address or another

    Been playing around with an email contact form with PHP so that the user can select which place they want their enquiry to go to, depending on which radio box they check.

    It seems to send to the second address, but not the first.

    "sendto" is the name of the radio boxes.

    I think I have it working through using 'switch', however I want to know why this way didn't work.

    Can anyone shed some light on this for me?

        $sendto = $_POST['sendto'];
        $subject = "Enquiry";
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        if($sento == "value1") {
        $to = "";
        $body = "Name: $name\nPhone: $phone\nEmail: $email\nMessage: $message\n";
        echo "Thank you. Your enquiry has been submitted to location 1.";
        mail($to, $subject, $body);
        elseif($sendto == "value2") {
        $to = "";
        $body = "Name: $name\nPhone: $phone\nEmail: $email\nMessage: $message\n";
        echo "Thank you. Your enquiry has been submitted to location 2.";
        mail($to, $subject, $body);
        echo "An error has occured. Please try again later.";

  2. #2
    if($sento == "value1") {
    should be
    if($sendto == "value1") {


  3. #3
    Ah ha!

    Hahahaha, I knew it'd be something silly like that. I read over it a heap of times too, and just missed it. >_<


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

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012