All pastes #2046908 Raw Edit

Someone

public text v1 · immutable
#2046908 ·published 2011-04-15 17:56 UTC
rendered paste body
<?php
/**
 * Template Name: Contact
 *
 */
?>

<?php get_header(); ?>

<?php
if(isset($_POST['submit'])) {
	if(trim($_POST['name']) == '') {
		$hasError = true;
	} else {
		$name = trim($_POST['name']);
	}
	if(trim($_POST['email']) == '')  {
		$hasError = true;
	} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
		$hasError = true;
	} else {
		$email = trim($_POST['email']);
	}
	if(trim($_POST['phone']) == '') {
		$hasError = true;
	} else {
		$name = trim($_POST['phone']);
	}
	if(trim($_POST['message']) == '') {
		$hasError = true;
	} else {
		if(function_exists('stripslashes')) {
			$comments = stripslashes(trim($_POST['message']));
		} else {
			$comments = trim($_POST['message']);
		}
	}
	if(!isset($hasError)) {
		$emailTo = 'info@joaoramos.org';
		$subject = 'Website feedback';
		$body = "Name: $name \n\nEmail: $email \n\nMessage:\n $comments";
		$headers = 'From: Vecturis.com <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
		mail($emailTo, $subject, $body, $headers);
		$emailSent = true;
	}
}
?>

				<div>
					<h2>Talk with us</h2>
					<form action="http://vecturis.com/contact-fr" method="post" class="contact">
						<label for="name">Name *</label>
						<input type="text" name="name" id="name" placeholder="Name or company" required />
						<label for="email">Email *</label>
						<input type="email" name="email" id="email" placeholder="So we can reach you back" required />
						<label for="phone">Phone number</label>
						<input type="text" name="phone?" id="phone" placeholder="We might get in touch with you" />
						<label for="message">Message *</label>
						<textarea id="message" name="message" placeholder="Please write us your question" required></textarea>						
						<input type="submit" name="submit" id="submit" value="Send" />
						
						<?php if(isset($hasError)) { ?>
							<span>Oops, seems like something's wrong.</span>
						<?php } ?>
						
						<?php if(isset($emailSent) && $emailSent == true) { ?>
							<span>Thank you for you feedback, <?php echo $name;?>.</p>
						<?php } ?>
						
					</form>
				</div>

				<div>
					<h2>How to reach us</h2>
					<iframe width="344" height="244" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.pt/?ie=UTF8&amp;ll=50.834701,4.35638&amp;spn=0.01843,0.045447&amp;z=15&amp;output=embed"></iframe>
					<ul>
						<li>Avenue Louise</li>
						<li>N.391 boite 24</li>
						<li>1050 Bruxelles</li>
						<li>Belgique</li>
					</ul>
				</div>

<?php get_footer(); ?>