form submit to email address

Discussion about the creation of websites in general, HTML, PHP, Java.

form submit to email address

Postby fishpoo222 on Thu Nov 17, 2005 2:05 pm

im wondering if anyone could help me with a form for a school website

it needs to look sort of like this

------------------------------------------------
|_______________________________________| (name goes here)

------------------------------------------------
| !
| !
| !
| (what they want to say goes ! | here) !
| !
| !
|______________________________________ !

------------------------------
| click to email |
------------------------------

SORRY FOR MY BAD DESCRIPTIONS BUT IVE HAD AROUND 5 HOURS SLEEP in the last week. please help me by posting anything aand everything youve got

thanks

David Very Happy
Image
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
fishpoo222
Regular
Regular
 
Posts: 104
Joined: Tue Oct 04, 2005 5:12 pm
Location: reigate,surrey,england

Postby stupergenius on Thu Nov 17, 2005 2:39 pm

If you have access to perl and a cgi-bin on the school's web server, then look no further than Formmail.
http://www.scriptarchive.com/formmail.html

If you do not have perl, then there are other ways, but some are not as secure. Basically any server side scripting you have available will do the job perfectly, while client side methods are susceptible to injection/XSS.

If you have another server side language let us know so we can reccommend other solutions.
stupergenius
Contributer
Contributer
 
Posts: 39
Joined: Wed Nov 16, 2005 1:18 am
Location: Columbus, Ohio

Postby Tim on Thu Nov 17, 2005 4:59 pm

As I am immensly bored and cannot sleep I decided to write something really basic in php....extremely easy to modify for any use and yeh...

[php]
if (isset($_REQUEST['post'])) {

$to = '[email protected]';

$subject = 'the message subject. ie. Form Submission from website!';

$message = "
Website submit form!!!!
Username: $_REQEUST['user']
E-mail: $_REQUEST['mail']
etc. etc.
";
$message = wordwrap($message, 70);


$headers = 'From: Webite Submit form <[email protected]>' . "\r\n" . 'Reply-To: [email protected]';

mail($to, $subject, $message, $headers);

echo "Form successfully submitted";

} else {

echo " <form action="#" mehthod='post'>
Username: <input type='text' name='user'><br>
E-mail: <input type='text' name='mail'><br>
etc. etc.
<input type='submit' value='submit'>
</form>
";

}
[/php]
User avatar
Tim
root
root
 
Posts: 736
Joined: Thu Mar 10, 2005 6:31 am
Location: Australia

Postby stupergenius on Thu Nov 17, 2005 10:29 pm

Gee, nice of you Tim, but it is rather insecure. It is easily modified to a sound script though. As it is, an attacker could easily use it to send a mass email to anyone of his choosing using the webserver's bandwidth.

http://securephp.damonkohler.com/index. ... _Injection
stupergenius
Contributer
Contributer
 
Posts: 39
Joined: Wed Nov 16, 2005 1:18 am
Location: Columbus, Ohio

Postby fishpoo222 on Fri Nov 18, 2005 11:35 am

is there a way of doing it in javascript? cos the rest of the site is based around that
Image
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
fishpoo222
Regular
Regular
 
Posts: 104
Joined: Tue Oct 04, 2005 5:12 pm
Location: reigate,surrey,england

Postby fishpoo222 on Fri Nov 18, 2005 1:51 pm

Your probably going to tell me to give java script a rest but with this project the email is not important and security isnt too much of a problem as the site is internal I just need a way of getting the text from the box adn giving it to the teacher with minimal effort and time
Image
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
fishpoo222
Regular
Regular
 
Posts: 104
Joined: Tue Oct 04, 2005 5:12 pm
Location: reigate,surrey,england

Postby krod on Fri Nov 18, 2005 4:05 pm

if your not concerned about security, use tim's php script.
I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived.-Thoreau
User avatar
krod
Phoenix Veteran
Phoenix Veteran
 
Posts: 616
Joined: Thu Mar 10, 2005 4:03 am
Location: USA/Georgia

Postby fishpoo222 on Fri Nov 18, 2005 5:15 pm

ok il give it a go
Image
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
fishpoo222
Regular
Regular
 
Posts: 104
Joined: Tue Oct 04, 2005 5:12 pm
Location: reigate,surrey,england

Postby mm_freak on Sat Nov 19, 2005 6:47 am

Tim, you've even taken the effort to syntax-highlight the source code. You must have been really bored. =)

krod wrote:if your not concerned about security, ...


The world is coming to an end.
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby fishpoo222 on Thu Nov 24, 2005 1:54 pm

mm_freak wrote:
krod wrote:if your not concerned about security, ...


The world is coming to an end.

I feel so proud to have launched the appocalypse Very Happy
Image
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
fishpoo222
Regular
Regular
 
Posts: 104
Joined: Tue Oct 04, 2005 5:12 pm
Location: reigate,surrey,england

Postby mikey1090 on Mon Nov 28, 2005 5:01 pm

not many people can be bothered wasting bandwith, and if you sign up to a good webhosting company, you wont need to worry too much about bandwith
mikey1090
Newbie
Newbie
 
Posts: 14
Joined: Sat Nov 26, 2005 12:00 pm

Postby mm_freak on Tue Nov 29, 2005 1:38 am

mikey1090 wrote:not many people can be bothered wasting bandwith, and if you sign up to a good webhosting company, you wont need to worry too much about bandwith


You're out of context, my friend. Maybe you should read and think before posting.
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby stupergenius on Tue Nov 29, 2005 1:59 am

mm_freak wrote:You're out of context, my friend. Maybe you should read and think before posting.


I was trying to figure out what he was trying to say as well, but I just gave up and thought it was just me. Surprised
stupergenius
Contributer
Contributer
 
Posts: 39
Joined: Wed Nov 16, 2005 1:18 am
Location: Columbus, Ohio

Postby mm_freak on Tue Nov 29, 2005 2:23 am

stupergenius wrote:I was trying to figure out what he was trying to say as well, but I just gave up and thought it was just me. :o


mikey1090 seems to be talking non-sense everywhere.
I'm x^10 + x^8 + x^5 + x^4 + x^3 + 1, so don't mess with me!
mm_freak
Moderator
Moderator
 
Posts: 635
Joined: Sun Sep 11, 2005 12:29 pm
Location: Baden-Wuerttemberg (Germany)

Postby Tim on Tue Nov 29, 2005 11:53 am

mm_freak wrote:Tim, you've even taken the effort to syntax-highlight the source code. You must have been really bored. =)

Nah, wasn't that bored,
Code: Select all
[php] [/php]
Wink

Sides...if I had tried the highlighting I would have had inconsistincies (sp?) Razz
User avatar
Tim
root
root
 
Posts: 736
Joined: Thu Mar 10, 2005 6:31 am
Location: Australia

Next

Return to General Webmastering

Who is online

Users browsing this forum: No registered users and 1 guest

cron