Jump to content

ElaineN46

New Members
  • Posts

    5
  • Joined

  • Last visited

ElaineN46's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ok I have played around with it....and moved stuff around, but to no avail, im sorry I guess I just don't have the php writing skills, does anyone have any suggestions on the placement of this code so it can work?
  2. how do you turn on error reporting?
  3. cause when I take it out and just put the whole page in php it gives an error and I am not a coder so I try by putting things together and testing...I have fun doing it and if it works well it works, if not I try and get help from people like you....who usually do not say that I am stupid, but all is good!
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <style> .error {color: #FF0000;} h6 { font-family: bookman old style; font-size:20px; text-align: center; font-weight: normal; } h5 { font-family: bookman old style; font-size:15px; text-align: center; font-weight: normal; } </style> <?php $nameErr = $emailErr = $websiteErr = $categoryErr; $name = $email = $comment = $website = $reset = $category; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; } else { $name = test_input($_POST["name"]); 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"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } } if (empty($_POST["website"])) { $websiteErr = "URL is required"; } else { $website = test_input($_POST["website"]); if (!preg_match("/\b(??:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) { $websiteErr = "Invalid URL"; } } if (empty($_POST["comment"])) { $comment = ""; } else { $comment = test_input($_POST["comment"]); } if (empty($_POST["category"])) { $categoryErr = "Category is required"; } else { $category = test_input($_POST["category"]); } if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['website']) && !empty($_POST['category'])) { $myemail = "links@loadsofads.com"; $subject = "Link Submission"; $message = "Your Link Submission form has been submitted by: Website Name: $name E-mail: $email URL: $website Category: $category Description: $comment"; mail($myemail, $subject, $message); header('location:submitthanks.php'); }} function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <?php include'header.php'?> <h6>Link Submission</h6> <h5><p><span class="error">* required field.</span></p> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> Name Of Site: <input type="text" name="name" value=""> <span class="error">* <?php echo $nameErr;?></span> <br><br> E-mail: <input type="text" name="email" value=""> <span class="error">* <?php echo $emailErr;?></span> <br><br> URL: <input type="text" name="website" value=""> <span class="error">* <?php echo $websiteErr;?></span> <br><br> Description: <textarea name="comment" rows="5" cols="40"></textarea> <br><br> Category Of Site: <select size="1" name="category"> <option value=""> -- Please select -- </option> <option>Arts</option> <option>Business</option> <option>Computers</option> <option>Games</option> <option>Health</option> <option>Home</option> <option>Kids and Teens</option> <option>News</option> <option>Recreation</option> <option>Reference</option> <option>Science</option> <option>Shopping</option> <option>Society</option> <option>Sports</option> <option>World</option> </select><span class="error">* <?php echo $categoryErr;?></span> <br><br> <input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset Form"> </form> <?php include'footer.php'?> Hello All, OK so I have been at this for a few days now and everywhere I go to learn or read information it says the same thing, to redirect the code is header('location:mypage.php');exit(); but it just will not redirect it every thing I try it does not load the redirect page. it clears the form and sits there, I do not know why! Can please someone please help me and see why it is not doing it? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.