Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 





Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read

Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
Thread Tools
Old 12-24-2005, 07:27 AM   #1 (permalink)
Registered User
 
Join Date: Dec 2005
Posts: 1
OS: WinXP


sending info help

i have a site layed out with two text boxes where people can write whatever the feel like writing.
i want to have whatever they typed into both boxes emailed to me when they press the "submit" button on the page.

can anyone tell me how i could go about doing this?
thanks..
-madalive8
Madalive8 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 12-24-2005, 10:29 AM   #2 (permalink)
Analyst, Security Team
 
MoralTerror's Avatar
 
Join Date: Nov 2005
Location: UK
Posts: 1,968
OS: xp


You could use php scripting,if you have a form something like this

Code:
<form method = post action = send_mail.php><br>
your email address:<br>
<input type = text name = from size = 38><br>
subject:<br>
<input type = text name = title size = 38><br>
your message:<br>
<textarea name = body cols = 30 rows = 10></textarea><br>
<input type = submit value = "Send"></form>
you could add more textareas say body2, body3 etc

then the send_mail.php file which would look something like

Code:
<?
$to_email = "your email address";
$content = $body      // for extra textareas $content = $body + $body2 + $body3..........
{
	mail($to_email,$title,$content,"From: $from\n");
}

?>


NB this code is just an example of how mail would be sent using the
submit button on the form, it doesn't encrypt the message. Validating
user's and/or user input is another point to consider.
MoralTerror is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 12-24-2005, 08:47 PM   #3 (permalink)
Registered User
 
bdemonbr's Avatar
 
Join Date: Jun 2005
Location: Chicago, IL
Posts: 64
OS: WinXP Pro / OS 10.4 / Fedora 9


Most hosting companies offer a "form to email" CGI script you can copy and paste - log into your hosting control panel to find it ....i emphasize "most"
bdemonbr is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 01-12-2006, 10:33 PM   #4 (permalink)
Cymru am byth
 
DumberDrummer's Avatar
 
Join Date: Oct 2003
Location: Oregon
Posts: 5,377
OS: Windows XP Pro SP2

My System

Send a message via AIM to DumberDrummer Send a message via Yahoo to DumberDrummer
Quote:
Originally Posted by MoralTerror
You could use php scripting,if you have a form something like this

Code:
<form method = post action = send_mail.php><br>
your email address:<br>
<input type = text name = from size = 38><br>
subject:<br>
<input type = text name = title size = 38><br>
your message:<br>
<textarea name = body cols = 30 rows = 10></textarea><br>
<input type = submit value = "Send"></form>
you could add more textareas say body2, body3 etc

then the send_mail.php file which would look something like

Code:
<?
$to_email = "your email address";
$content = $body      // for extra textareas $content = $body + $body2 + $body3..........
{
	mail($to_email,$title,$content,"From: $from\n");
}

?>


NB this code is just an example of how mail would be sent using the
submit button on the form, it doesn't encrypt the message. Validating
user's and/or user input is another point to consider.
That's mostly right, except you need to specify that the variables are coming from the previous script...

PHP Code:

<?

$content 
$_POST['body'];
$from=$_POST['from'];
$title=$_POST['title'];
$to_email "[i]your email address[/i]";
//Don't know why there were braces around this, as far as I know, its not necessary
mail($to_email,$title,$content,"From: $from\n");


?>
Again, if you want to add more text, simply make more textareas, with different names.

Then the names become part of the POST variables. If you want all of the textareas sent to you, you need to assign them to the same variable though. If you want a header for each different textarea for your email, so you can tell where one begins and the other ends, you can do that too.

So the code becomes this:

PHP Code:

<?

$content 
"The textarea\n" +$_POST['body']+ "The Second Textarea\n"+$_POST['body2']; // or +$_POST['NAME OF TEXTAREA HERE']
$from=$_POST['from'];
$title=$_POST['title'];
$to_email "[i]your email address[/i]";
//Don't know why there were braces around this, as far as I know, its not necessary
mail($to_email,$title,$content,"From: $from\n");
?>

Let me know if you need help customizing it!
__________________

Living with Louie dog's the only way to stay sane
_____________________________________________

... and with those words so begins my lifetime of longing for the devil's warm embrace

Last edited by DumberDrummer : 01-12-2006 at 10:34 PM.
DumberDrummer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 01-19-2006, 08:02 PM   #5 (permalink)
Registered User
 
bdemonbr's Avatar
 
Join Date: Jun 2005
Location: Chicago, IL
Posts: 64
OS: WinXP Pro / OS 10.4 / Fedora 9


This php form works, but I'm having some probs. I go to fix all of the html e.g. to change:
input type = submit value =" Send"
to:
input type="submit" value="Send"

but it keeps changing back!!! WHY?????

I'll fix it and open up ws_ftp and view the code from there and it will show the first version. Is this a setting in ws_ftp?
bdemonbr is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 01-19-2006, 08:09 PM   #6 (permalink)
Cymru am byth
 
DumberDrummer's Avatar
 
Join Date: Oct 2003
Location: Oregon
Posts: 5,377
OS: Windows XP Pro SP2

My System

Send a message via AIM to DumberDrummer Send a message via Yahoo to DumberDrummer
you need to upload the new file. Saving it on your computer doesn't save it to the server.
__________________

Living with Louie dog's the only way to stay sane
_____________________________________________

... and with those words so begins my lifetime of longing for the devil's warm embrace
DumberDrummer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 01-19-2006, 08:17 PM   #7 (permalink)
Registered User
 
bdemonbr's Avatar
 
Join Date: Jun 2005
Location: Chicago, IL
Posts: 64
OS: WinXP Pro / OS 10.4 / Fedora 9


okay..so I just fixed the file again but uploaded it using command prompt and it didn't change the code this time. Any ideas why ws_ftp would be doing this?
bdemonbr is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 01-19-2006, 08:19 PM   #8 (permalink)
Registered User
 
bdemonbr's Avatar
 
Join Date: Jun 2005
Location: Chicago, IL
Posts: 64
OS: WinXP Pro / OS 10.4 / Fedora 9


Quote:
Originally Posted by DumberDrummer
you need to upload the new file. Saving it on your computer doesn't save it to the server.
okay..sorry I wasn't very clear. I would upload it to the server and then notice it was changed back once it was there. Then I noticed that it was changing it before I uploaded it to the server by "viewing" the file through ws_ftp. Weird?

I've been using ws_ftp for 3 years now and this is the first time I've ever seen it do this.

Last edited by bdemonbr : 01-19-2006 at 08:21 PM.
bdemonbr is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 01-20-2006, 02:54 AM   #9 (permalink)
Analyst, Security Team
 
MoralTerror's Avatar
 
Join Date: Nov 2005
Location: UK
Posts: 1,968
OS: xp


Quote:
Originally Posted by DumberDrummer
That's mostly right, except you need to specify that the variables are coming from the previous script...
yeah I didn't specify in the example, however I should have mentioned this.



Quote:
Originally Posted by DumberDrummer
$to_email = "your email address";
//Don't know why there were braces around this, as far as I know, its not necessary
your quite right, I put them there to emphasis your email address, you don't need them and I see where there may be a misunderstanding, my apologies I should have been clearer.
MoralTerror is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -7. The time now is 05:38 PM.



Copyright 2001 - 2008, Tech Support Forum

Search Engine Friendly URLs by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82