Created
August 23, 2012 18:45
-
-
Save jkishner/3440165 to your computer and use it in GitHub Desktop.
email fields as per Patrick Rhone's reimagining
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link href='http://fonts.googleapis.com/css?family=Quicksand' rel='stylesheet' type='text/css'> | |
<STYLE type="text/css"> | |
textarea { | |
font-size:18px; | |
font-family: 'Quicksand', sans-serif; | |
outline: none; //see "remove the blue glow" at http://css-tricks.com/textarea-tricks/ | |
} | |
input.btn { | |
font-size:18px; | |
font-family: 'Quicksand', sans-serif; | |
} | |
</STYLE> | |
</head> | |
<body> | |
<?php | |
/* if the "submit" variable does not exist, the form has not been submitted - display initial page */ | |
if (!isset($_POST['submit'])) { | |
?> | |
<div align="center"> | |
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> | |
<textarea name="body" cols="120" rows="25"></textarea><br> | |
Recipient: <input name="recipient" size="30"><br> | |
Subject: <input name="subject" size="30"><br> | |
<input type="submit" name="submit" value="Submit"> | |
</form> | |
</div> | |
<?php | |
} | |
else | |
/* if the "submit" variable exists, the form has been submitted - look for and process form data */ | |
// display result | |
{ | |
$body = $_POST['body']; | |
$subject = $_POST['subject']; | |
$recipient = $_POST['recipient']; | |
$body = stripslashes($body); | |
$body = rawurlencode($body); | |
$body = str_replace("?","%3F",$body); | |
$body = str_replace("&","&",$body); | |
$subject = stripslashes($subject); | |
$subject = rawurlencode($subject); | |
$subject = str_replace("?","%3F",$subject); | |
$subject = str_replace("&","&",$subject); | |
//$body = str_replace("%","%25",$body); | |
echo '<a href="mailto:' . $recipient . '?body=' . $body . '&subject='. $subject . '">Click to email</a>'; | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does not currently include line breaks in body of email. Any help welcome!