Welcome to WebProNews Breaking eBusiness and Search News
Advertise | Newsletter | Sitemap | News Feeds News Feed 
 WebProNews Search Part of the iEntry network iEntry inc. 

Simple User Request Forms

A.P. Lawrence
Expert Author
Published: 2003-03-26

WebProNews RSS Feed


We often have the need for simple forms that request certain actions like adding a new user, etc. A simple perl script lets us do this with a web form that then emails the results.

The example here can be modified to meet your needs. The things that you need to know are noted in comments.


#!/usr/bin/perl
use CGI qw(:standard);
$posting=param('posting');
if (defined $posting) {
# this section only happens when the form is submitted
  $email=param('ab_email');
# your email may not be /bin/mail 
  open MAIL, "|/bin/mail -s "IT User Request" itstaff@yourcompany.com";
  $requestor="|/bin/mail -s "Your IT User Request" $email";
  open MAILO, $requestor;
  print MAIL "Subject: IT user requestnn";
  print MAILO "$Subject: Your IT user requestnn";
  print MAILO "nConfirming your request:nn";
# print the results to mail
foreach $i (param) {
# skip the posting flag
  next if $i =~ /posting/;
  foreach $j (param($i) ) {
    $v=$i;
# strip off the prefix
    $v =~ s/^.._//;
    print MAIL "$v = $jn";
    print MAILO "$v = $jn";
  }
}
print header, <<EOF;
<html><head><title> IT User Request</title></head><body>
<h2>Accepted, thank you</h2>
<form action="/cgi-bin/simpleform.pl" method=POST>
EOF
foreach $i (param) {
  next if $i =~ /posting/;
  foreach $j (param($i) ) {
    $v=$i;
    $v =~ s/^.._//;
    print "<br>$v = $jn";
  }
}
print <<EOF;
<p><input type=submit name=accept value="OK">
</form>
</body></html>
EOF
exit 0;
}
# this is what happens when the script is first called
print  header, <<EOF;
<html><head><title> IT User Request</title></head><body>
<h2>IT User Request</h2>
<form action="/cgi-bin/simpleform.pl" method=POST>
#
# you can modify any of these.  The first 3 characters of 
# the variable names let us easily control order if we need to
#
<p>Requested by: <input type=text name=aa_requestor size=20>
<p>Your email: <input type=text name=ab_email size=20>
<p>Your telephone: <input type=text name=ab_phone size=20>
<p><input name=ac_type type=radio value="New User">New User
<input name=ac_type type=radio value="Terminate User">Terminated User
<p>User's Login <input type=text name=ad_user_login size=4>
<p>User's name: <input type=text name=ae_username size=20>
<p>(if new) Desired password: <input type=text name=af_desired_password size=20>
<p>Systems to add or terminate:
<p> <input name=ag_systems type=checkbox value="Network">Network
<p> <input name=ag_systems type=checkbox value="Unix">Unix
<p> <input name=ag_systems type=checkbox value="File and Print">File and Print
<p> <input name=ag_systems type=checkbox value="E-Mail">E-Mail
<p> <input name=ag_systems type=checkbox value="E-Fax">E-Fax
<p> <input name=ag_systems type=checkbox value="Telephone/Voice Mail">Telephone/Voice Mail
<p><textarea name=zz_notes rows=10 cols=80 wrap=physical></textarea>
#
<p><input type=submit name=posting>
</form>
</body></html>
EOF



Download simpleform.pl (right click and use "save target as")
More Code

Please Read the Disclaimer
Copyright and Reprint Info

Receive Our Daily Email of Breaking eBusiness News


About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

WebProNews RSS Feed

More Articles

Contact WebProNews
Advertisement





TOP NEWS

Targeted Information for Business
WebProNews is part of the iEntry network

Internet Business: Marketing: Small Business:
WebProNews MarketingNewz SmallBusinessNewz
WebProWorld AdvertisingDay PromoteNews
EcommNewz SalesNewz EntrepreneurNewz

Software: Search Engines: Web Design:
WebMasterFree Jayde B2B DesignNewz
NetworkingFiles SearchZA FlashNewz
SecurityConfig SearchNewz WebSiteNotes

Developer: IT Management: Security:
DevWebPro ITManagement SecurityProNews
DevNewz SysAdminNews SecurityConfig
TheDevWeb NetworkingFiles NetworkNewz

The iEntry Network consists of over 100 web publications reaching millions of Internet Professionals. Contact us to advertise.
eBUSINESS RESOURCES






 Advertise | Contact Us | Corporate | Newsletter | Sitemap | Submit an Article | News Feeds
 WebProNews is an iEntry, Inc. ® publication - $line) { echo $line ; } ?> All Rights Reserved
About WebProNews
WebProNews is the number one source for eBusiness News. Over 5 million eBusiness professionals read WebProNews and other iEntry business and tech publications.

WebProNews provides real-time coverage of internet business.

Free Email Newsletters:
WebProNews SearchNewz
WebProWorld DevWebPro
Marketing SecurityNews
Plus over 100 other newsletters!

Send me relevant info on products and services.


WebProWorld
Ten most recent posts.

NetworkingFiles
Featured Software

WebProNews in the News
View all recent mentions of WebProNews from around the world!

Recent Articles On ...
Google eBusiness
Yahoo Ask Jeeves
MSN Blogs
Search Engines Blogging
Affiliate Programs Marketing
eCommerce Advertising
eBay Sun Microsystems
AOL Adsense
Microsoft Adwords
Oracle IBM
Amazon Apple
SEM Mac
SEO iPod
Adsense XBox
PR Adobe



iEntry.com WebProWorld RSS Feed WebProWorld Contact WebProNews Print Version Email a friend Bookmark us