Okay I think I understand what you are wanting. I have a multi purpose page I use to do various things like this.
PHP Code:
<?
require("toptemplate.php");
require("funcs.php"); ?>
<!-- Start Main Body here -->
<?
if( $sendmail != "" ){
if($theirname!="" and $theiremail!="" and $messagebody!="" and vmail($theiremail)=="YES"){
$emessage = "$theirname ~ $theiremail \n \n They wrote: \n $messagebody";
mail("bobert@YourSite.com", "Message from YourSite.com",
"$emessage \n\n\n I Collected the following information on $theirname: \n $userinf",
"From: YourSite.com <webmaster@YourSite.com>\nX-Mailer: PHP/" . phpversion());
mail("$theiremail", "Your message to YourSite.com" ,
"You Wrote: \n $messagebody \n\n\n If your message requires a reply you should expect it within 24 hours. \n Thank you for using YourSite.com!",
"From: YourSite.com <webmaster@YourSite.com>\nX-Mailer: PHP/" . phpversion());
print("<p>You should recieve an auto reply within a few minutes.</p> \n".
"<p>Click <a href='$returnto'>here</a> to return to the page you were on.</p> \n");
} else {
print("<p>You did not fill out all required feilds, or you entered an invalid email address.</p> \n".
"<p>Click <a href='$PHP_SELF'>here</a> to return and try again.</p> \n".
"<p>Click <a href='$returnto'>here</a> to return to the page you were previously on.</p> \n");
}
} else {
$returnto = "$HTTP_REFERER";
$userinf = "The user was using: ".$HTTP_USER_AGENT."\n IP: ".$REMOTE_ADDR."\n They Came From: ".$returnto;
print("<p><FONT COLOR='#F80517'>All fields are required.</FONT></p>\n".
"<form name='form1' method='post' action='$PHP_SELF'> \n".
"<table width='100%' border='0'> \n".
"<tr> \n".
"<td width='150'>Your Name:</td> \n".
"<td> \n".
"<input type='text' name='theirname' size='40' maxlength='40'> \n".
"</td> \n".
"</tr> \n".
"<tr> \n".
"<td width='150'>Your Email:</td> \n".
"<td> \n".
"<input type='text' name='theiremail' size='40' maxlength='40'> \n".
"</td> \n".
"</tr> \n".
"<tr> \n".
"<td height='2' width='150'>Message:</td> \n".
"<td height='2'> </td> \n".
"</tr> \n".
"<tr> \n".
"<td width='150'> </td> \n".
"<td> \n".
"<textarea name='messagebody' cols='40' wrap='PHYSICAL' rows='20'></textarea> \n".
"</td> \n".
"</tr> \n".
"</table> \n".
"<p> </p> \n".
"<table width='100%' border='0'> \n".
"<tr> \n".
"<td width='10%'> </td> \n".
"<td width='45%'> \n".
"<input type='submit' name='sendmail' value='Send'> \n".
"</td> \n".
"<td width='45%'> \n".
"<div align='right'> \n".
"<input type='reset' name='Submit2' value='Reset'> \n".
"</div> \n".
"</td> \n".
"</tr> \n".
"</table> \n".
"<p> </p> \n".
"<INPUT TYPE='hidden' name='returnto' value='$returnto'> \n".
"<INPUT TYPE='hidden' name='userinf' value='$userinf'> \n".
"</form> \n");
}
?>
<!-- End Main Body here -->
<?require("bottemtemplate.php");?>
Now I did not have time to clean that up or change it for you so you will have to do that. You will get an error running it unless you make a function called "vmail()" or delete that condition from the top iff statement. Again sorry I dont have time to explain it now but if you play with it it *should work out okay. Change all of the accourding domain names in the two "mail()" functions also. Good luck and I'll check back later to se if you have any questions.
Bookmarks