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.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Sep 2016
    Posts
    5
    Member #
    55275

    can someone help me with my contact forum.

    so, i'm creating a website and i have a contact forum, but i can't seem to get it to work properly. can someone check it out for me and see what i have done wrong? when i test it i get a error that says all fields are required. the page url is http://swiftboosts.com/contact.html

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,480
    Member #
    425
    Liked
    2784 times
    That's server-side code processing your script on the other hand, so it would be difficult for anyone to diagnose without seeing the code. The one thing I would suggest is to make sure that all four of the fields are being processed CaSe-SeNsItIvElY on contact-form-handler.php, no more, and no less. In other words, make sure you see things such as $_POST["comments"] and not $_POST["Comments"].
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Junior Member
    Join Date
    Sep 2016
    Posts
    5
    Member #
    55275
    Quote Originally Posted by TheGAME1264 View Post
    That's server-side code processing your script on the other hand, so it would be difficult for anyone to diagnose without seeing the code. The one thing I would suggest is to make sure that all four of the fields are being processed CaSe-SeNsItIvElY on contact-form-handler.php, no more, and no less. In other words, make sure you see things such as $_POST["comments"] and not $_POST["Comments"].
    Thanks, what you suggested wasn't exactly what was wrong but it let me to where the problem was, but now after the page sents the information to my email i get everything but the message its self. i'll post the script so you can see it.

    .PHP
    PHP Code:
    <?php 

    $errors 
    '';
    $myemail 'test@swiftboosts.com';//
    if(empty($_POST['name'])  || 
       empty(
    $_POST['email']) || 
       empty(
    $_POST['subject']) ||
       empty(
    $_POST['comments']))
    {
        
    $errors .= "\n Error: all fields are required";
    }

    $name $_POST['name']; 
    $email_address $_POST['email']; 
    $email_subject=$POST['subject'];
    $message $_POST['comments']; 

    if (!
    preg_match(
    "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i"
    $email_address))
    {
        
    $errors .= "\n Error: Invalid email address";
    }

    if( empty(
    $errors))
    {
        
    $to $myemail
        
    $email_subject "Contact form submission: $name";
        
    $email_body "You have received a new message. ".
        
    " Here are the details:\n Name: $name \n Email: $email_address \n Comments: $comments"
        
        
    $headers "From: $myemail\n"
        
    $headers .= "Reply-To: $email_address";
        
        
    mail($to,$email_subject,$email_body,$headers);
        
    //redirect to the 'thank you' page
        
    header('Location: contact-form-thank-you.html'); 

    ?>

    <html>
    <head>
        <title>Contact form handler</title>
    </head>

    <body>
    <!-- This page is displayed only if there is some error -->
    <?php
    echo nl2br($errors);
    ?>


    </body>
    </html>



    HTML:

                                </div>
                              
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>Your Name</label>
                                    <input type="text" name="name" class="form-control" placeholder="John Doe">
                                  </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>Email Address</label>
                                    <input type="email" name="email" class="form-control" placeholder="johndoe@gmail.com">
                                  </div>
                                </div>
                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>Subject</label>
                                    <input type="text" name="subject" class="form-control" placeholder="Question Regarding Payments">
                                  </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>Message</label>
                                    <textarea rows="5" name="comments" class="form-control"></textarea>
                                  </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                  <div class="form-group">
                                      <button type="submit" class="btn btn-primary pull-right"><i class="fa fa-send"></i> Send</button>
                                  </div>
    I left the first few lines on the html coding out because it has personal information in it, but there is nothing in those few lines that would cause it to not send me the comments details.
    Last edited by mlseim; Sep 25th, 2016 at 04:22 PM.

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,480
    Member #
    425
    Liked
    2784 times
    Is the value of the $myemail variable your email address?
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Junior Member
    Join Date
    Sep 2016
    Posts
    5
    Member #
    55275
    Quote Originally Posted by TheGAME1264 View Post
    Is the value of the $myemail variable your email address?
    yes, thats the personal information i was leaving out. the forum sends the information to me email but when i check the email i get this.

    You have received a new message. Here are the details:
    Name: Sage
    Email: luck@gmail.com
    Comments:


    the recieved email is just something i made up to test to see if it worked, but as you can see under comments the forum didn't send the response. not only that but it looks like its not submitting the subject either....
    Last edited by Sage; Sep 25th, 2016 at 01:15 PM.

  7. #6
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,480
    Member #
    425
    Liked
    2784 times
    At this point, someone with more PHP experience than I have would have to pitch in. I'm going to move it there for you and hopefully someone will see it. PHP is my third server-side programming language.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  8. #7
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,139
    Member #
    27197
    Liked
    959 times
    Add this to the top of the script:
    PHP Code:
    error_reporting(E_ALL); 
    Then comment out this line:
    PHP Code:
    header('Location: contact-form-thank-you.html'); 
    Run it and let us know what, if any errors are showing up.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  9. #8
    Junior Member
    Join Date
    Sep 2016
    Posts
    5
    Member #
    55275
    Quote Originally Posted by Ronald Roe View Post
    Add this to the top of the script:
    PHP Code:
    error_reporting(E_ALL); 
    Then comment out this line:
    PHP Code:
    header('Location: contact-form-thank-you.html'); 
    Run it and let us know what, if any errors are showing up.
    so i ran the new codes and i got a internal error when commenting out the header line. i noticed in my previous thread the some of the php code got left out. i'm making the update on that so double check it for me.
    Last edited by Sage; Sep 25th, 2016 at 03:18 PM.

  10. #9
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,139
    Member #
    27197
    Liked
    959 times
    Your subject isn't coming thru in part because in this line:
    PHP Code:
    $email_body "You have received a new message. ".
    " Here are the details:\n Name: $name \n Email: $email_address \n Comments: $comments"
    the variable $comments is empty. It should be $message. I can't be sure, but that is likely erroring out the whole line.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  11. #10
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,973
    Member #
    5580
    Liked
    760 times
    Repost the entire thing again ...

    This time, wrap the script between php and /php brackets [ ]



Page 1 of 2 1 2 LastLast

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 03:51 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com