Jump to content

oldNsad

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Location
    Denver, CO
  • Interests
    Website design, Mint vinyl LP's, & promotional 45's.

oldNsad's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I think I need to start over with this. I need to work on/understand it more. Thanks for trying to help!!
  2. Man, thank you so much for being patient and responding to each point. I do know that I have things wrong, I tend to get a bit confused. The tuts can show how to do the same thing 5 different ways, and it looks like I do a bit of each But to get it right, I do know that the patters are identical, I just used that for ease of testing. I will change them. Is the pattern not defined correctly? (not withstanding the simple val part)(is it in the right place and can it have different values for each place it shows in function?) I do see the error in the simple anti-spam validation. Can you suggest a simple query for JS to get the same email values and echo to empty table in thankyou.htm?
  3. My questions are as follows: ++++ This line is flagged as an error. Why?? (it’s exactly the same as line 8 rows above, which is NOT flagged) Error message is: PHP Parse error: syntax error, unexpected '}' in /mailit.php on line 44 PHP Parse error: syntax error, unexpected '}' in /mailit.php on line 44 +++++ How can I make this pattern validate a specific number that was input? ++++++ I want this line to validate_form_email, how do I do it? +++++++ I want this to take user to thanks.html page that will also echo info sent. Also, I would like to trim input of special chars., where can I do this in the function? Thanks in Advance to anyone that took the time to try and help. I tried to figure it out for one entire week, so please understand that I want to learn it, not just ask someone else to do it for me. But for the life of me I can't get this. Where did I go wrong? (BTW: I successfully tested server with simple email test). <?php if (isset($_POST['submitted'])) { //to load var $_POST = "name"; $_POST = "email"; $_POST = "about"; $_POST = "nospam"; $_POST = "textarea"; $errors = array(); $name = $_POST['name']; $email = $_POST['email']; $about = $_POST['about']; $nospam = $_POST['nospam']; $textarea = $_POST['textarea']; //validation if (!empty($_POST['name'])) { $name = $_POST['name']; } else { $errors[] = 'Please enter your Name.';} if (preg_match($pattern,$name)){ $name = $_POST['name'];} $pattern = "/^[a-zA-Z0-9_]{2,20}/"; } else {$errors[] = 'Your Name can only contain letters and numbers.';} if (!empty($_POST['email'])) { $email = $_POST['email']; } else {$errors[] = 'Please enter your email address.';} if (preg_match($pattern,$email)){ $email = $_POST['email'];} $pattern = "/^[a-zA-Z0-9_]{2,20}/"; } else {$errors[] = 'Your Email must be Valid.';} if (!empty($_POST['about'])) { $about = $_POST['about']; } else {$errors[] = 'Please enter a Subject here.';} if (preg_match($pattern,$about)){ $about = $_POST['about'];} $pattern = "/^[a-zA-Z0-9_]{2,20}/"; } else {$errors[] = 'What is this contact about?';} if (!empty($_POST['nospam'])) { $nospam = $_POST['nospam']; } else {$errors[] = 'Please answer the Anti-Spam Question';} $pattern = ('/^[a-zA-Z0-9_]{2,20}/'); if (preg_match($pattern,$nospam)){ $nospam = $_POST['nospam'];} } else {$errors[] = 'Hmmm. Can you try this again?';} if (!empty($_POST['textarea'])) { $textarea = $_POST['textarea']; } else {$errors[] = 'Please enter your Message.';} if (preg_match($pattern,$textarea)){ $textarea = $_POST['textarea'];} $pattern = "/^[a-zA-Z0-9_]{2,20}/"; } else {$errors[] = 'Your Message can only contain regular letters and numbers.';} //compile and send email if (isset($_POST['submitted'])) { if (empty($errors)) { $to = "info@ anything.com"; $from = "info@anything.com"; $subject = "Comment from anything Website"; $message = "Message from" . $_POST['name'] . "rnrn"; "Email Address " . $_POST['email'] . "rnrn"; "About " . $_POST['about'] . "rnrn"; "Text " . $_POST['textarea'] . ""; } } mail($to, $from, $subject, $message); //verify submission and show errors if (isset($_POST['submitted'])) { if (!empty($errors)) { echo '<hr /><h3>The following occurred:</h3><ul>'; foreach ($errors as $msg) { echo '<li>'. $msg . '</li>';} echo '</ul><h3>Your mail could not be sent due to input errors.</h3><hr />';} else { echo '<hr /><h3 align="center">Your mail was sent. Thank you!</h3><hr /><p>Below is the message that you sent.</p>'; echo "Message from" . $name . " " . $email . " " . $subject. " " . $textarea . ""; } } exit:('Redirecting you to http://www.anything.com/swg/thankyou.html');
×
×
  • Create New...