-1

I have written several versions of my code and this is the closest that I have come in attempting to have my customer submit an email to me agreeing to my Terms and Conditions.

<head>
    <meta charset="utf-8">
    <meta name="robots" content="noindex,nofollow">
    <meta name="robots" content="noimageindex">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
    <meta name="description" content="">
    <meta name="author" content="">

</head>

<body> 

    <p>

        <p align="center"> Rental and Damage Liability Waiver
        </p>
        <br />
        

            <p>I hereby agree that by renting any equipment from Sand Surfers, LLC, I accept liability for any<br />damages or injury that may occur while using any of the equipment- regardless of its condition- rented<br />from Sand Surfers, LLC By signing this agreement, I understand that I am waiving my right to bring a court of action to recover compensation or obtain any other remedy for any injury to myself, my<br />property, or my death, however, caused, arising out of my use of any equipment from Sand Surfers, LLC I understand that there are inherent risks associated with the activities offered by Sand Surfers, LLC including Onewheel electric skateboard use.
            </p>
            <p><br />I understand that equipment and safety devices are required for my use (such as a helmet). I understand that Sand Surfers, LLC, does not provide these items, and it is my responsibility to provide my own. I agree that I will be solely responsible for the proper use of safety and other equipment and procedures. It is my responsibility to inspect all equipment. I, the undersigned user-or guardian of user-HEREBY RELEASE on behalf of myself, my heirs, representatives, managers, successors, executors, and administrators of Sand Surfers, LLC its officers, agents, and employees from any cause of action, claims, or demands whatsoever including, but not limited to, a claim of negligence.
            </p>
            <p><br />I also agree that if the equipment is damaged, lost, or misplaced, that I rent from Sand Surfers, LLC, I will pay for the losses or damages. I agree that if Sand Surfers, LLC incurs any cost associated with recovery of payment for damages or losses (such as court costs, collection costs and/or attorney costs) that I will reimburse or pay Sand Surfers, LLC for these costs as well as the cost of the damaged items.
            </p>
            <p><br />It is solely the discretion of Sand Surfers, LLC, to determine if damaged equipment will be repaired or replaced at the renter’s expense.
            </p>
            <p>I agree that Sand Surfers, LLC can charge my account daily late fees for any rental not returned on the due date with or without my consent.
            </p>
            <p>I agree that Sand Surfers, LLC can charge the full retail price of any rental product not returned<br />within 24 hours of the expiration of the rental term without my consent.I (renters) am responsible for ensuring all equipment is used correctly and attached. I also agree to not operate the equipment under the influence of drugs or alcohol. Sand Surfers, LLC I understand that the terms of this agreement are legally binding, and I certify that I am signing this agreement, after having carefully read it, of my own free will.
            </p>

            <p><strong>*Warning*</strong>
            </p>
            <p>RISK OF DEATH OR SERIOUS INJURY: Whenever you ride a Onewheel, you risk death or serious injury from loss of control, collisions, and falls. To ride safely you must follow all instructions and warnings in the user manual.
            </p>
            <ul>
                <li>Always wear protective equipment including an appropriate helmet and appropriate shoes when riding.
                </li>
                <li>Do not allow children under the age of 14 ride this product.
                </li>
            </ul>
            <p>&nbsp;
            </p>
            <p>Signature of User or Guardian if under 18 below
            </p>
        <form method="post" action="/action-page.php">
            <p>
                <label for='name'> Enter Your Legal Name: </label><br>
                <input type="text" name="name" required>
            </p>
            <p>
                <label for='email'> Enter Your Email Address: </label><br>
                <input type="text" name ="email" required>
            </p>

            I agree to be legally bound by this agreement and Terms of Use
            <input type="submit" name="Agree" method="post">

        </form>

    </p>
    
    <?php
    
    $name = $_POST['name'];
    $visitor_email = $_POST['email'];
    
    $email_from = 'mjm@sandsurfersoceanshores.com';
    $email_subject = "Onewheel Waiver Document Agreement";
    $email_body = "You have a new document from $name. \n".
        "Email Address: $visitor_email\n".
        "Here is the Message: $message".
        
    $to = "mjm@sandsurfersoceanshores.com";
    $headers = "From: $email_from \r\n";
    $headers .= "Reply-To: $visitor_email \r\n";
    
    mail($to,$email_subject,$email_body,$headers);
    ?>
    
</body>

The result of the above code is: enter image description here

What am I missing that I am getting Page Not found instead of email being sent?

Sean
  • 1
  • 1
    I think you should use empty form action because you are processing sent data in the same page. – Makiomar Apr 17 '22 at 22:18
  • This is what my code looks like now based upon your recommendation. I did not get the page not found by removing the action. No errors, but I did not receive the email. Other suggestions.?
    – Sean Apr 19 '22 at 06:00
  • If you get a `404 Not Found` error when you submit the form then you just typed the wrong URL into the `action` attribute. – Quentin Apr 19 '22 at 08:38
  • Does this answer your question? [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – DarkBee Apr 19 '22 at 08:50

1 Answers1

0

Please try the following code, i have just removed the action value, also i had to add an empty variable $message = ""; because you were using it in email body but undefined, also i have checked weather $_POST contains the key name to make every thing consistent without errors.

Please change this:

<form method="post" action="/action-page.php">

To

<form method="post" action="">

And you php block to:

<?php
  
  if( isset( $_POST['name'] ) ){
    $name = $_POST['name'];
    $visitor_email = $_POST['email'];

    $message = "";
    
    $email_from = 'mjm@sandsurfersoceanshores.com';
    $email_subject = "Onewheel Waiver Document Agreement";
    $email_body = "You have a new document from $name. \n".
        "Email Address: $visitor_email\n".
        "Here is the Message: $message".
        
    $to = "mjm@sandsurfersoceanshores.com";
    $headers = "From: $email_from \r\n";
    $headers .= "Reply-To: $visitor_email \r\n";
    
    mail($to,$email_subject,$email_body,$headers);
    }
  
  ?>
Makiomar
  • 106
  • 1
  • 9
  • I did what you suggested. My web site I am build and web server support is through GoDaddy. My code is acting like I am not executing the PHP section by changing the action per your suggestion. When I reached out to GoDaddy to ensure I am not getting blocked on the backend with the server somehow, they are stating that my 'Submit' button is not working. I would think that it was working since I was not getting a Page Not Found when I hit submit. This is the last piece that I need to figure out before I can go live. How can I verify that the Submit button is working? – Sean May 01 '22 at 19:31
  • I don't see that the submit button is not working. Could you please test on localhost – Makiomar May 03 '22 at 13:47