jjr0319
12-09-2005, 03:19 PM
i have an email form that works, however, the message is coming from "nobody@midphase". how do i get it to come from the email address inputted in the form below?
<?php
$recipient = email@yahoo.com';
if(isset($_POST['Email'])){
$message = '';
foreach($_POST as $k => $v){
if($k!='submit'){
$message .= "$k: ".stripslashes($v)."\n\n";
}
}
if(@mail($recipient, 'Email from '.$_SERVER['HTTP_HOST'], $message)){
$message = 'Your email has been sent. Thank you for your message.';
}else{
$message = 'Error sending the mail!';
}
}
?>
<?php if(!isset($message)){ ?>
<br>Fill the form out below to contact me.
<form action="http://<?php print $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; ?>" method="post" id="mailform">
<TABLE BORDER=0 class="contentcell" width="100%">
<tr>
<td ALIGN=RIGHT VALIGN=TOP class="text"><b>Email:</b></td>
<td ALIGN=LEFT colspan="5"><input name="Email" id="Email" size=40></td>
</tr>
<tr>
<td ALIGN=RIGHT VALIGN=TOP><b>Subject:</b></td>
<td ALIGN=LEFT colspan="5"><input name="Subject" id="Subject" size="50"></td>
</tr>
<tr>
<td ALIGN=RIGHT VALIGN=TOP class="text"><b>Comments:</b></td>
<td ALIGN=LEFT colspan="5"><textarea cols="50" rows="10" name="comments" id="comments">Enter Comments Here.</textarea></td>
</tr>
</TABLE>
</center>
<table width="100%" border="0">
<tr>
<td colspan="9" align="center"><input type="submit" id="submit" value="Contact Me"> <input type="reset" id="reset" value="Clear Form">
</td>
</tr>
</table>
</form>
<?php }else{ ?>
<br><b><?php print $message; ?></b>
<?php } ?>
thanks in advance.
<?php
$recipient = email@yahoo.com';
if(isset($_POST['Email'])){
$message = '';
foreach($_POST as $k => $v){
if($k!='submit'){
$message .= "$k: ".stripslashes($v)."\n\n";
}
}
if(@mail($recipient, 'Email from '.$_SERVER['HTTP_HOST'], $message)){
$message = 'Your email has been sent. Thank you for your message.';
}else{
$message = 'Error sending the mail!';
}
}
?>
<?php if(!isset($message)){ ?>
<br>Fill the form out below to contact me.
<form action="http://<?php print $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; ?>" method="post" id="mailform">
<TABLE BORDER=0 class="contentcell" width="100%">
<tr>
<td ALIGN=RIGHT VALIGN=TOP class="text"><b>Email:</b></td>
<td ALIGN=LEFT colspan="5"><input name="Email" id="Email" size=40></td>
</tr>
<tr>
<td ALIGN=RIGHT VALIGN=TOP><b>Subject:</b></td>
<td ALIGN=LEFT colspan="5"><input name="Subject" id="Subject" size="50"></td>
</tr>
<tr>
<td ALIGN=RIGHT VALIGN=TOP class="text"><b>Comments:</b></td>
<td ALIGN=LEFT colspan="5"><textarea cols="50" rows="10" name="comments" id="comments">Enter Comments Here.</textarea></td>
</tr>
</TABLE>
</center>
<table width="100%" border="0">
<tr>
<td colspan="9" align="center"><input type="submit" id="submit" value="Contact Me"> <input type="reset" id="reset" value="Clear Form">
</td>
</tr>
</table>
</form>
<?php }else{ ?>
<br><b><?php print $message; ?></b>
<?php } ?>
thanks in advance.