|
-
Apr 7th, 2008, 01:50 PM
#1
Thread Starter
Lively Member
send text to an email
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.
-
Apr 7th, 2008, 02:13 PM
#2
Re: send text to an email
-
Apr 7th, 2008, 06:12 PM
#3
Re: send text to an email
you are going to need to send headers for the from part.
My usual boring signature: Something
-
Apr 7th, 2008, 07:37 PM
#4
Thread Starter
Lively Member
Re: send text to an email
-
Apr 7th, 2008, 07:49 PM
#5
Re: send text to an email
My usual boring signature: Something
-
Apr 7th, 2008, 07:53 PM
#6
Thread Starter
Lively Member
Re: send text to an email
no. it is not working.
<?php
$firstname=(string)$_POST["txtFirst"];
$headers ='[email protected]'. phpversion();
mail('[email protected]','Registration testing',$firstname,$headers);
echo 'done';
?>
-
Apr 7th, 2008, 08:01 PM
#7
Re: send text to an email
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';
?>
Last edited by dclamp; Apr 7th, 2008 at 08:14 PM.
My usual boring signature: Something
-
Apr 7th, 2008, 08:18 PM
#8
Thread Starter
Lively Member
Re: send text to an email
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>
-
Apr 7th, 2008, 08:41 PM
#9
Re: send text to an email
can you please edit your post using [php][/php] tags or [html][/html] tags, thanks
My usual boring signature: Something
-
Apr 8th, 2008, 04:05 AM
#10
Re: send text to an email
 Originally Posted by Academy
no. it is not working.
<?php
$firstname=(string)$_POST["txtFirst"];
$headers =' [email protected]'. phpversion();
mail(' [email protected]','Registration testing',$firstname,$headers);
echo 'done';
?>
Your headers are incorrectly formatted. They need to be in the format Name: value\r\n.
E.g
Code:
$headers = 'From: [email protected]\r\n';
$headers .= 'X-Client:' phpversion();
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|