Jump to content

ndgz102489

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by ndgz102489

  1. Gotcha. Thank you.

    So, I got the form to work, but I receive an e-mail and the results copies what was written in between the quotation marks in the PHP file. How do I get the form to write the appropriate information such as the recipient's name, e-mail, phone number, and message?

    Screen Shot 2021-06-24 at 12.58.42 PM.png

  2. 11 minutes ago, ndgz102489 said:

     

    Here is the PHP code:

    <?php
    var_dump($_POST);
    // Check for empty fields
    if (isset($_POST['button'])) {
       empty($_POST['name'])
       empty($_POST['email'])
       empty($_POST['phone'])
       empty($_POST['message'])
         echo "You gotta fill it out!";
         return false;
       }

    $name = strip_tags(htmlspecialchars($_POST['name']));
    $email = strip_tags(htmlspecialchars($_POST['email']));
    $phone = strip_tags(htmlspecialchars($_POST['phone']));
    $message = strip_tags(htmlspecialchars($_POST['message']));

    // Create the email and send the message
    $to = 'ned@nerdcorestudio.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
    $subject = "Website Contact Form:  $name";
    $text = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email\n\nPhone: $phone\n\nMessage:\n$message";
    $header = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
    mail($to,$subject,$text,$header);
    header("Location: index.html?mailsent")
    return true;
    if(mail($to, $subject, $text, $header)) {
        echo 'Thank You!';
        } else {
        echo 'boo, no email was sent';
        }

    ?>

    This is the error that I've received from the error log.

    Screen Shot 2021-06-23 at 7.37.11 PM.png

  3.  

    23 hours ago, niche said:

    There's all kinds potential reasons for your code not to work. Please repost your code using the code tags so we can copy paste it, for a closer look.

    In the meantime, add this snippet to line two of your contact.php file:

    var_dump($_POST);

    That will tell you what you're actually getting from your form. So, let us also know what you're seeing.

    FYI, your problem may not be with you code.  Your server may not be set up to send emails.

    Use this tutorial to check that out and let us know what happened:

    https://www.w3schools.com/php/func_mail_mail.asp 

    Here is the PHP code:

    <?php
    var_dump($_POST);
    // Check for empty fields
    if (isset($_POST['button'])) {
       empty($_POST['name'])
       empty($_POST['email'])
       empty($_POST['phone'])
       empty($_POST['message'])
         echo "You gotta fill it out!";
         return false;
       }

    $name = strip_tags(htmlspecialchars($_POST['name']));
    $email = strip_tags(htmlspecialchars($_POST['email']));
    $phone = strip_tags(htmlspecialchars($_POST['phone']));
    $message = strip_tags(htmlspecialchars($_POST['message']));

    // Create the email and send the message
    $to = 'ned@nerdcorestudio.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
    $subject = "Website Contact Form:  $name";
    $text = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email\n\nPhone: $phone\n\nMessage:\n$message";
    $header = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
    mail($to,$subject,$text,$header);
    header("Location: index.html?mailsent")
    return true;
    if(mail($to, $subject, $text, $header)) {
        echo 'Thank You!';
        } else {
        echo 'boo, no email was sent';
        }

    ?>

  4. Greetings,

    I have a contact form on my website, but it is not working. When I fill out the form and press "Submit", I don't receive any inquiries to my e-mail. Now, I am not familiar of PHP, but I have found a simple contact form template in the interwebs. I had followed the instructions on how to make to use it, but it doesn't seem to work. I am unsure if I am missing a code, but it is giving me a headache.

     

    I've attached the screenshots.

    Screen Shot 2021-06-22 at 6.50.48 PM.png

    Screen Shot 2021-06-22 at 6.50.59 PM.png

×
×
  • Create New...