on the click of a submit button, I'd like to send the text from a textbox to an email address.
textbox: txtTest
from : [email protected]
to: [email protected]
Please provide sample code,
Thanks.
Printable View
on the click of a submit button, I'd like to send the text from a textbox to an email address.
textbox: txtTest
from : [email protected]
to: [email protected]
Please provide sample code,
Thanks.
you are going to need to send headers for the from part.
yes!
did you get it to work?
no. it is not working.
<?php
$firstname=(string)$_POST["txtFirst"];
$headers ='[email protected]'. phpversion();
mail('[email protected]','Registration testing',$firstname,$headers);
echo 'done';
?>
try this...
PHP Code:<?php
error_reporting(E_ALL);
$firstname=$_POST["txtFirst"];
$headers ='[email protected]'. phpversion();
@mail('[email protected]','Registration testing',$firstname,$headers);
echo 'done';
?>
still not working. I wonder if it has anything to do with the HTML page.
<form id="register" name="register" method="post" action="email.php">
<table width="599" height="368" border="1">
<tr>
<td width="500"><table width="576" height="327">
<tr>
<td width="216"><div align="right" class="normal">First Name: </div></td>
<td width="330"><input name="txtFirst" type="text" id="txtFirst" /></td>
<td width="14"> </td>
</tr>
<tr>
<td><div align="right">
<p class="normal">Last (Family) Name:</p>
</div></td>
<td><input name="txtLast" type="text" id="txtLast" /></td>
<td> </td>
</tr>
<tr>
<td><div align="right">
<p class="normal">Address:</p>
</div></td>
<td><input name="txtAddr" type="text" id="txtAddr" /></td>
<td> </td>
</tr>
<tr>
<td><div align="right">
<p class="normal">Telephone Number:</p>
</div></td>
<td><input name="txtTel" type="text" id="txtTel" /></td>
<td> </td>
</tr>
<tr>
<td><div align="right">
<p class="normal">Cell Number:</p>
</div></td>
<td><input name="txtCell" type="text" id="txtCell" /></td>
<td> </td>
</tr>
<tr>
<td><div align="right">
<p class="normal">AA&ITN:</p>
</div></td>
<td><input name="txtAA" type="text" id="txtAA" /></td>
<td> </td>
</tr>
<tr>
<td><div align="right" class="normal">Trade: </div></td>
<td><input name="txtTrade" type="text" id="txtTrade" /></td>
<td> </td>
</tr>
<tr>
<td><div align="right" class="normal">Best time to contact you: </div></td>
<td><input name="txtBest" type="text" id="txtBest" /></td>
<td> </td>
</tr>
<tr>
<td><div align="right" class="normal">Other Notes: </div></td>
<td><textarea name="textarea"></textarea></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
<p>
<input name="btnSubmit" type="submit" id="btnSubmit" value="Submit" />
</p>
</form>
can you please edit your post using [php][/php] tags or [html][/html] tags, thanks
Your headers are incorrectly formatted. They need to be in the format Name: value\r\n.Quote:
Originally Posted by Academy
E.g
Also you may want to set the sendmail_from directive n the php.ini to the from address too, to prevent an errornous reply_to header.