I got bored so I thought I'd code something up for the fun of it, so I thought back when I used to struggle at FORMS and sending them to a e-mail address. Below is some basic PHP to build your form and send it to the specified email.
You can add as many items to the array. so blow yourself away.
I haven't tested the mailer properly as i was using WAMP when coding, so yeah. It hopefully will work.
omgz <?php <<--- Zomgz.
parrrrrrrrrtaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay :eusa_dancPHP Code:<?php
$forms = array( "input|name|Name*",
"password|password|Email Address*",
"textarea|message|Message*");
$siteurl = "jamesrozee.com";
$email = "[email protected]"; // Email you want your mail sent to.
$font = "Tahoma"; // tahoma, it owns
$size = "2"; // font size
$title = "My Test Form!"; // page titleizzle
$textb4 = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."; // Include images if you think your pr0
// - this next, I wouldn't edit in all fairness unless you have too. - dont cry.
echo('<html><head><title>'.$title.'</title></head><body>');
if($_GET["x"] == "exec") {
for($i = 0; $i < sizeof($forms); $i++) {
$formation = explode("|", $forms[$i]);
if(str_replace("*", "", $formation[2])) { if($_POST[$formation[1]] == "") { $relay = false; echo('<font face="'.$font.'" size="'.$size.'">'.str_replace("*", "", $formation[2]).' is a required field.<br>'); } elseif($_POST[$formation[1]] != "") { $mailit = $mailit.$formation[2]." = ".$_POST[$formation[1]]."<br>"; } } else { $mailit = $mailit.$formation[2]." = ".$_POST[$formation[1]]."<br>"; }
unset($formation); }
if(!$relay == false) {
$mailit = str_replace("*", "", $mailit);
$subject = "";
$headers = 'From: '.$email . "\r\n" .
'Reply-To: '.$email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email, $subject, $mailit, $headers); }
} else {
echo('<form method="post" action="?x=exec"><table width="500" border="0" cellpadding="5"><tr><td colspan="2"><font face="'.$font.'" size="'.$size.'">'.$textb4.'</font></td></tr>');
for($i = 0; $i < sizeof($forms); $i++) {
$formation = explode("|", $forms[$i]);
$name = $formation[1];
// $namex = str_replace("*", "", $formation[2]);
$namex = $formation[2];
echo('<tr><td><font face="'.$font.'" size="'.$size.'">');
if($formation[0] == "input") { echo($namex.'</font></td>');
echo('<td><input type="text" name="'.$name.'"></td>');
} elseif($formation[0] == "textarea") { echo($namex.'</font></td>');
echo('<td><textarea name="'.$name.'"></textarea></td>');
} elseif($formation[0] == "password") { echo($namex.'</font></td>');
echo('<td><input type="password" name="'.$name.'"></td>');
} else { echo($namex.'</font></td>');
echo('<td><input type="text" name="'.$name.'"></td>'); }
echo('</tr>');
unset($formation); }
echo('<tr><td><input type="submit" value="Submit"></td></tr></table></form></body></html>');
}
?>





Reply With Quote