473,434 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Form to Email - Getting Started

15
Ok here is the problem i face... ive learnt enuff Perl to make more than a few things work and im also touching on javascript... and i suppose this can br for javascript as well... what im needing is a script or part of a script to get the input of a form to appear in an email as it is setout by the form... how can i do this weather through Javascript or through Perl it dosent bother me which...

-- DD

"In a world the doesn't comprehend"
Aug 2 '07 #1
5 1289
numberwhun
3,509 Expert Mod 2GB
Well, in this forum, you will only be able to work on the Perl script. Since this is not a script writing service, could you please post the code that you have tried so far? From there, we will help you get things working.

Also, not to be anal, but:

s/learnt/learned/
s/enuff/enough/
s/im/i'm/g
s/weather/whether/ # unless of course you are expecting rain
s/dosent/doesn't/
s/br/??/ # not sure what word this was supposed to be.

Perl can definitely get the information from a form and could even format it the way you wish, but we would like to see what you have tried.

Regards,

Jeff
Aug 2 '07 #2
DDragon
15
ok here is what i have atm..

Expand|Select|Wrap|Line Numbers
  1. #!F:/perl/bin/perl
  2. # order.pl
  3. # Created by: Anthony Gilbert (AKA DDragon) (c) copyright 2007 Anthony Gilbert
  4.  
  5. use CGI ':standard';
  6.  
  7. print ("content-type: text/html\n\n");
  8.  
  9. my $name, $address, $date, $phone, $page, $code, $description, $qty, $catprice, $value, $ammount;
  10.  
  11. $name = param('txtName');
  12. $address = param('txtAddress');
  13. $date = param('txtDate');
  14. $phone = param('txtPhone');
  15. $page = param('txtP1');
  16. $code = param('txtCode1');
  17. $description = param('txtBdes1');
  18. $qty = param('txtQty1');
  19. $catprice = param('txtCatpri1');
  20. $value = param('txtValue1');
  21. $ammount = param('txtAmmount');
  22.  
  23. print "<html>\n<head>\n<title>Penny Miller Order Confirmation\n</title>\n</head>\n";
  24. print "<body>\nPlease check this information is correct before you continue this order:<br /><br />\n";
  25. print "<form name=\"frmCorder\" method=\"post\" action=\"mailto:egdavis\@optusnet.com.au?subject=Penny Miller Order\">\n";
  26. print "<input type=\"textarea\" name=\"taOrder\">\n";
  27. print "
  28. print "</form>\n</body>\n";
  29. print "<a href=\"$site\">Click here for your favorite site</a>";
  30.  
unfortunatly i didnt get as fara s getting it to format itself for sending in an email..

it works so all i neeed to know is the basics of layout for sending in an email so it can be read :S

thanks for the assist
Aug 3 '07 #3
KevinADC
4,059 Expert 2GB
It is good to know how to write your own email function, but really, the MIME::Lite module takes care of all the behind the scenes stuff for you. You can send the email as plain text or html encoded, with attachements, as attachments, etc etc etc. It is not a core module but many hosts have it installed.

cpan: MIME::Lite

If you are going to continue with your perl education and writing cgi scripts you must learn about fundamental cgi security. The first rule of cgi programming is:

never trust user input (never ever ever)

the second rule is: see the first rule.

All form fields must be checked and validated, use the -T switch on the shebang line and learn how to untaint data. Here are some links discussing cgi security resources:

http://www.cgi101.com/book/ch19/

-Kevin
Aug 3 '07 #4
DDragon
15
Thanks for that mate :) it's greatly appreciated. I only learn't enough about perl to make basic scripts so the scurity is somthing im still learning. Ill be putting the -T with the shebang line from now on and wih my old scripts as well :).

again thanks Kevin

-- DD
Aug 4 '07 #5
miller
1,089 Expert 1GB
And don't forget "use strict;" while you're trying to follow good programming practices.

And for style, use a here doc for output lots of html instead of multiple print statements. They're a lot easier to use since you don't have to spend all that effort escaping all those double quotes. Although, you do still have to escape the @:

Expand|Select|Wrap|Line Numbers
  1. #!F:/perl/bin/perl
  2. # order.pl
  3. # Created by: Anthony Gilbert (AKA DDragon) (c) copyright 2007 Anthony Gilbert
  4.  
  5. use CGI ':standard';
  6.  
  7. use strict;
  8.  
  9. print "Content-type: text/html\n\n";
  10.  
  11. my $name        = param('txtName');
  12. my $address     = param('txtAddress');
  13. my $date        = param('txtDate');
  14. my $phone       = param('txtPhone');
  15. my $page        = param('txtP1');
  16. my $code        = param('txtCode1');
  17. my $description = param('txtBdes1');
  18. my $qty         = param('txtQty1');
  19. my $catprice    = param('txtCatpri1');
  20. my $value       = param('txtValue1');
  21. my $ammount     = param('txtAmmount');
  22.  
  23. print <<"END_OF_PAGE";
  24. <html>
  25. <head>
  26. <title>Penny Miller Order Confirmation</title>
  27. </head>
  28. <body>
  29. Please check this information is correct before you continue this order:<br />
  30. <br />
  31. <form name="frmCorder" method="post" action="mailto:egdavis\@optusnet.com.au?subject=Penny Miller Order">
  32. <input type="textarea" name="taOrder">
  33. </form>
  34. </body>
  35. </html>
  36. END_OF_PAGE
  37.  
- Miller
Aug 4 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Jim | last post by:
Hi, I keep getting form results emailed to me that would indicate a form from my web site is getting submitted with all fields blank or empty, but my code should preventing users from proceeding...
15
by: Dominic Tocci | last post by:
When I submit a form to an asp page, the request.form is not getting the data. This only happens on my local copy of IIS, and not on my web host. It's a simple request.form, so I know it's not a...
18
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm =...
8
by: news | last post by:
I seriously doubt this is possible...but you never know, so here goes. Due to bad pre-planning I have a Web page that is VERY table heavy with a very complicated and delicate setup. Any changes...
3
by: tony bergstrom | last post by:
Ok, so I have a Form. It is a continuous form. In the header one selects what person to view data for. Once the person is selected, the travel information that has been budgeted for the year...
2
by: Esa | last post by:
Hi, I'm having problems with one strange web system where submitting an application and making queries about its handling status require a series of form submits and response parsing - all in...
4
by: SteveKlett | last post by:
I have a subset of form items that I need to perform different operations on (enable/disable, clear values, change style, etc) rather than hard code the IDs or names I would like to recursively...
2
by: Comcast | last post by:
I am using a form that uses PHP to create an e-mail and send it off. When the script runs, I get an error page, although the e-mail is sent off. The error I am getting is: Warning:...
1
by: valmae | last post by:
Please help anyone! I am getting this error after the submit button is clicked to this form which was designed in Dreamweaver in ASP. Microsoft VBScript compilation error '800a0401' Expected...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.