Jump to content

ren

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by ren

  1. Hi Hassan, thank you very much for your response. I’m still trying to figure this out. Thanks again!
  2. Okay, thank you for your help with this! I knew I was doing something wrong. I appreciate the guidance very much. Thanks!
  3. Hi, thank you very much for your response! When I test the contact form, I get basically the same error message in all browsers and I've included the one from Firefox ... Is it because I'm testing this on my laptop? The files are not on a server yet. Also, where would I include the email address to route this to? For sure, I'm not doing this correctly. By the way, I removed the link element from the page. Thank you again for your help!
  4. Hi, I’ve been trying to get a functioning contact form for a website that I’m building and, thus far, I haven’t been able to accomplish this. I’ve worked on this for a few days now and read through the tutorials but I still don’t under what I’m doing. Probably because I struggle to understanding coding. The code that I’m working with is included below. Thank you in advance for any help you can give me! Here is the code that I have placed in the head of the document: <link rel="action_page" href="action_page.php"> action_page.php code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php // define variables and set to empty values $nameErr = $emailErr = $subjectErr = $messageErr = ""; $name = $email = $subject = $message = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; } else { $name = test_input($_POST["name"]); // check if name only contains letters and whitespace if (!preg_match("/^[a-zA-Z-' ]*$/",$name)) { $nameErr = "Only letters and white space allowed"; } } if (empty($_POST["email"])) { $emailErr = "Email is required"; } else { $email = test_input($_POST["email"]); // check if e-mail address is well-formed if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } } if (empty($_POST["subject"])) { $subjectErr = "Subject is required"; } else { $subject = test_input($_POST["subject"]); } } if (empty($_POST["message"])) { $message = "Message is required"; } else { $message = test_input($_POST["message"]); } ?> </body> </html> Here is the html code for the form itself: <form action="action_page.php" method="post" target="_blank"> <p><input class="w3-input w3-border" type="text" placeholder="Name" required name="Name"></p> <p><input class="w3-input w3-border" type="text" placeholder="Email" required name="Email"></p> <p><input class="w3-input w3-border" type="text" placeholder="Subject" required name="Subject"></p> <p><input class="w3-input w3-border" type="text" placeholder="Message" required name="Message"></p> <p><button class="w3-button w3-black" type="submit"> <i class="fa fa-paper-plane"></i> SEND MESSAGE</button> </p> </form>
×
×
  • Create New...