Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Feb 2015
    Posts
    1
    Member #
    41531

    Angry HELP! PHP Form not working completely but partially!!!

    So the title says it all. I have a simple PHP Form on my website. When a user fills out the form part of it submits, except two of the questions on the form ( service_requested AND preferred_datetime) The other areas work. What is wrong with my code???

    <?php
    if(isset($_POST['submit'])){
    $to = "dare2dreamdesign@gmail.com"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $first_name = $_POST['first_name'];
    $email_address = $_POST['email_address'];
    $phone_number = $_POST['phone_number'];
    $service_requested = $_POST['service_req'];
    $preferred_datetime = $_POST['preferred_datetime'];
    $subject = "Appointment Request";
    $subject2 = "Copy of your Appointment Request";
    $message = $first_name . " " . $email_address . " " . $phone_number . " " . $service_requested . " " . $preferred_datetime . "wrote the following:" . "\n\n" . $_POST['message'];
    $message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    header('Location: thankyou.html');
    // You can also use header('Location: thankyou.html'); to redirect to another page.
    // You cannot use header and echo together. It's one or the other.
    }
    ?>

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,686
    Member #
    5580
    Liked
    716 times
    The two things in red MUST be exactly the same spelling as the names in your HTML form (which you didn't show us).

    $service_requested = $_POST['service_req'];
    $preferred_datetime = $_POST['preferred_datetime'];

    That's the best I can answer without enough information given.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:04 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com