Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <?php
$submitted = $_POST['submitted'];
$displayForm = TRUE;
if(isset($submitted)) {
	$problem = FALSE; //no problems so far...
	$startErr = "<div id=\"error\" role=\"alert\">\n<p><strong>These fields are required:</strong></p>\n<ul>\n";
	$endErr = "</ul>\n</div>\n";

	//check for name
	if (empty($_POST['name'])) {
		$problem = TRUE;
		$errStr .= "<li>your name</li>\n";	
	} else {
		$name = htmlentities(stripslashes(trim($_POST['name'])));
	}
	
	//check for email
	if (empty($_POST['email'])) {
		$problem = TRUE;
		$errStr .= "<li>your e-mail</li>\n";	
	} else {
		$email = htmlentities(stripslashes(trim($_POST['email'])));
	}	
	
	//check for subject
	if (empty($_POST['subject'])) {
		$problem = TRUE;
		$errStr .= "<li>message subject</li>\n";	
	} else {
		$subject = htmlentities(stripslashes(trim($_POST['subject'])));
	}	

	//check for body
	if (empty($_POST['body'])) {
		$problem = TRUE;
		$errStr .= "<li>your message</li>\n";	
	} else {
		$body = htmlentities(stripslashes(trim($_POST['body'])));
	}
	
	//check for honeypot
	if ($_POST['honeypot'] == 1) {
		$problem = TRUE;
		$errStr .= "<li>Are you a bot?</li>\n";
	}

	if ($problem) {
		print "$startErr $errStr $endErr";

	} else { //process form
	
		$displayForm = FALSE;
		
		//send email
		$to  = 'email@example.com' . ', '; // note the comma
		$to .= '';

		$headers = 	'From: email@example.com' . "\r\n" .
    				'Reply-To: ' . $email . "\r\n" .
    				'X-Mailer: PHP/' . phpversion();
					
		$message = 	'From: ' . $name . "\r\n\n" .
					'Email: ' . $email . "\r\n\n" .
					$body . "\r\n";
					
		mail($to, $subject, $message, $headers, $pageTitle);
			
			if (isset($_POST['copy'])) { 
				$to = $email . ', '; // note the comma
				$to .= '';
	
				$headers = 	'From: email@example.com' . "\r\n" .
							'Reply-To: noreply@example.com' . "\r\n" .
							'X-Mailer: PHP/' . phpversion();
						
				$message = 	$body . "\r\n";
						
				mail($to, 'Copy of your message to Your Name: ' . $subject, $body, $headers);		
			}
				
		print "<p id=\"success\" tabindex=\"-1\">Your message was sent successfully!</p>";
		
	}
}
if ($displayForm) {
?>
<form name="contact" id="contact" action="#success" method="post">
  <div class="form--field">
    <label for="name">Name</label>
    <input type="text" name="name" id="name" required value="<?php if (isset($_POST['name'])) { print htmlspecialchars($_POST['name']); }?>">
  </div>
  <div class="form--field">
    <label for="email">E-mail</label>
    <input type="email" name="email" id="email" required value="<?php if (isset($_POST['email'])) { print htmlspecialchars($_POST['email']); }?>">
  </div>
  <div class="form--field">
    <label for="subject">Message Subject</label>
    <input type="text" name="subject" id="subject" required maxlength="100" value="<?php if (isset($_POST['subject'])) { print htmlspecialchars($_POST['subject']); }?>" />
  </div>
  <div class="form--field">
    <label for="body">Message</label>
    <textarea name="body" id="body" rows="10" required maxlength="1000"><?php if (isset($_POST['body'])) { print htmlspecialchars($_POST['body']); }?></textarea>
  </div>
  <label for="honeypot" aria-hidden="true" class="visually-hidden">Honeypot <input type="radio" name="honeypot" id="honeypot" style="display:none" value="1"></label>
  <p><label for="copy"><input type="checkbox" name="copy" id="copy" value="true"> Send a copy of this message to your e-mail address.</label></p>
  <button type="submit" name="submit">Send Message</button>
  <input type="hidden" name="submitted" value="true" />
</form>
<?php
}
?>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console