SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Nov 2012
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Two Contact Forms. Is it Possible

    I'm afraid that PHP is a mystery to me, but I have a site where I want two contact forms to be available, with the subsequent "thank you" pages being different for each one.

    At present they both go to the same pages.

    The pages are: http://www.c5d.co.uk/addresschange.php which when complete goes to http://www.c5d.co.uk/send_contact.php

    The second page is http://www.c5d.co.uk/addresschangetwo.php which also goes to http://www.c5d.co.uk/send_contact.php I'd like it to go to
    http://www.c5d.co.uk/send_contacttwo.php Is this possible and if so how.

    Please reply as if you were talking to a simpleton. When it comes to this you are.

    This is the coding



    <?php

    // Contact subject
    $subject ="$Contact Form";

    // Details
    $message="$detail";


    // Mail of sender
    $mail_from="$customer_mail";

    // From
    $header="from: $detail <$mail_from>";


    // Enter your email address
    $to ='antonylambert@c5d.co.uk';

    $send_contact=mail($to,$subject,$message,$header);


    // Check, if message sent to your email
    // display message "We've recived your information"
    if($send_contacttwo){
    echo "Thanks for sending this change of details. I shall update our records right away.";
    }
    else {
    echo "ERROR";
    }
    ?>




    Thanks

    Antony

  2. #2
    Avid Logophile silver trophy
    ParkinT's Avatar
    Join Date
    May 2006
    Location
    Central Florida
    Posts
    2,343
    Mentioned
    192 Post(s)
    Tagged
    4 Thread(s)
    Antony,
    This is incredibly simple.

    In each of those pages ('addresschange.php' and 'addresschangetwo.php') you will find this line of HTML
    Code:
    <form name="form1" method="post" action="send_contact.php"></form>
    That represents the page that will accept the submitted form data. In this case, it is also the page that is displayed to the user.

    Just change that "send_contact.php" value to "send_contacttwo.php" as appropriate.
    Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)


    Git is for EVERYONE
    Literally, the best app for readers.
    Make Your P@ssw0rd Secure
    Leveraging SubDomains

  3. #3
    SitePoint Addict
    Join Date
    Nov 2012
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that, the form comes through now, but it is not sending details. IE, the info I type in, does not come through on the e mail. And the E Mail comes through twice.

    Where have I gone wrong ?

    This is the HTML/CSS I am using.


    <ul class="opendays">
    <li>
    <p><strong>Change of Address</strong></p>
    </li>
    </ul>

    <ul class="opendays">
    <li>
    <p><form name="form1" method="post" action="send_contacttwo.php"></li>
    <li>
    <p>Please note my new details</p>
    <p></p>
    </li>
    <li>
    <p>With effect from/p>
    <p><input name="subject" type="text" id="subject" size="50"></p>
    </li>
    <li>
    <li>
    <p>Name</p>
    <p><input name="subject" type="text" id="subject" size="50"></p>
    </li>
    <li>
    <p>New Address</p>
    <p><textarea name="detail" cols="50" rows="4" id="detail"></textarea></p>
    <p></p>
    </li>
    <li>
    <p>New Phone Number</p>
    <p><input name="name" type="text" id="name" size="50"></p>
    <p></p>
    </li>
    <li>
    <p>New Mobile Number</p>
    <p><input name="name" type="text" id="name" size="50"></p>
    <p></p>
    </li>
    <li>
    <p>New Email Address</p>
    <p><input name="customer_mail" type="text" id="customer_mail" size="50"></p>
    <p></p>
    </li>
    <li>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></p>
    </li>
    </ul>
    </form>

    Thanks for help

    Antony


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
  •