rendered paste body<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' > <head> <title> form submission </title> <meta http-equiv='Content-Type' content='application/xhtml+xml; charset=UTF-8' /> <meta name='robots' content='index, follow' /> <style> form, input { font: 11px/100% tahoma, verdana, sans-serif; color: #333; } fieldset { width: 40%; } input { width: 150px; } #btn input { width: 60px; } a { color: #c00; } p { border: 1px solid #ccc; padding: 2px; width: 250px; }</style></head><body> <?php if(!isset($_POST['submit'])) { ?> <form method='post' action='<?php echo $_SERVER['PHP_SELF']; ?>'> <fieldset> <legend> form submission </legend> <table> <tr> <td>Full name: </td> <td><input type='text' name='name' /></td> </tr> <tr> <td>Email:</td> <td><input type='email' name='email' /></td> </tr> <tr> <td>Address:</td> <td><input type='text' name='address' /></td> </tr> <tr> <td>Contact #.:</td> <td><input type='text' name='contact' /></td> </tr> <tr> <td>Message:</td> <td><textarea name='message' cols='30' rows='5'></textarea></td> </tr> <tr> <td> </td> <td> <div id='btn'> <input type='submit' name='submit' value='Submit' /> <input type='reset' value='Clear' /> </div> </td> </tr> </table> </fieldset> </form> <?php } else { if(!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['address'])) { if (preg_match('/[a-z ]/i', $_POST['name']) && preg_match('/[a-zA-Z09]/', $_POST['email']) && preg_match('/@/', $_POST['email']) && preg_match('/./',$_POST['email']) && preg_match('/[a-zA-Z0-9 ]/', $_POST['address']) && preg_match('/[0-9]/', $_POST['contact'])) { $name = $_POST['name']; $email = $_POST['email']; $address = $_POST['address']; $contact = $_POST['contact']; $message = stripslashes($_POST['message']); echo 'thank you for submitting.'; $to = 'manilagurl@gmail.com'; $subject = 'user submission'; $msgs = $name . '<br />' . $email . '<br />' . $address . '<br />' . $contact . '<br />'; $msgs .= $message; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to, $subject, $msgs, $headers); } else { echo '<p>invalid inputs.</p>'; echo '<a href=\'form.php\'>Try again</a></p>'; } } else { echo '<p>name, email, adddress fields cannot be empty.</p>'; } } ?></body></html>